Write a Java application with a main() to find the two largest distinct integers entered on the command line by the user. We are just creating a simple stand-alone application. All your code can be in main().

Answers

Answer 1

Answer:

import java.util.Scanner; // Scanner class is to use input output functions

public class TwoDistinctLargest //class to find two distinct largest nos

{

public static void main(String[] args) { //start of main() function

Scanner input = new Scanner(System.in); // creates Scanner type object

       int integers = 0, largest1 = 0, largest2 = 0; // declare variables

/* integers holds the input integer values, largest1 has 1st largest number and largest 2 contains second distinct largest number, i is used as the count variable to move through the input integers */

       int i = 0;  

//prompts user to enter integers and enter 0 to stop

       System.out.println("Enter the integers (press 0 to stop): ");

       integers = input.nextInt(); //reads and scans input integers

       while(integers != 0) {

/* the loop keeps taking integer values from user until the value of integers is equal to 0, this means until the user enters 0 */

//checks if the value of integer is greater than first largest computed number

           if(integers > largest1) {

//if the value in largest1 is greater than that of largest2

               if(largest1 > largest2) {

                   largest2 = largest1; } // then value of largest1 is set to largest2                

               largest1 = integers; // largest1 now holds the value of integers //which means largest1 holds the first distinct largest integer

           } else { //checks if the value of integers is greater than largest2

               if(integers > largest2) {

//if the value of integers is not equal to that of largest1

                   if(integers!=largest1)  {

// set the value of second distinct largest number to largest2

                   largest2 = integers;}              }            }

                     i++; //keeps moving to the next input integer

           integers = input.nextInt();     //keeps taking input integers    }      

//prints the two distinct largest integers

       System.out.println("\n The 1st largest distinct integer is " + largest1);

       System.out.println("\n The 2nd largest distinct integer is " + largest2); } }

Explanation:

Lets suppose the user inputs the following integers

1, 6, 5, 6, 0

Initial values are:

integers = 0

largest1 = 0

largest2 = 0

i = 0

When the user enters 1, then value of integers = 1

while loop checks if integers!=0. As integers =1 so the program enters the body of while loop. The first IF condition is checked if(integers > largest1)

As largest1 = 0 and integers =1 so this condition evaluates to true as 1 > 0

So the statements in the body of this IF condition are executed. This if conditions contains another if statement if(largest1 > largest2) which checks if the value largest1 is greater than that of largest2. Its false because largest1 =0 and largest2 =0 so largest1 = largest2, so the statement of this if condition body will not execute and program moves to this                 largest1 = integers; statement which sets the value of integers i.e. 1 to largest1. So the value of largest1 = 1

Now the i is incremented by 1 and it points at second value of integers= 6.

while loop checks if integers!=0. As integers =6 so the program enters the body of while loop. The first IF condition is checked if(integers > largest1)

As largest1 = 1 and integers =6 so this condition evaluates to true as 6>1

So the statements in the body of this IF condition are executed. This if conditions contains another if statement if(largest1 > largest2) which checks if the value largest1 is greater than that of largest2.

Its true because largest1 =1 and largest2 =0 so largest1 > largest2, so the next statement is executed largest2 = largest1; So now the value of largest2=1.

Now program moves to this largest1 = integers; statement which sets the value of integers i.e. 6 to largest1. So the value of largest1 = 6

Now the i is incremented by 1 and it points at second value of integers= 5.

while loop condition is again true. IF condition is checked if(integers > largest1)

As largest1 = 6 and integers =5 so this condition evaluates to false as 5<6. So this IF part will not execute and program control moves to the else part.

Else part has an if condition if(integers > largest2) which evaluates to true because integers = 5 and largest2 = 1 so the program moves to next if statement inside the previous if statement of else part i.e. if(integers!=largest1). This if statement is the main statement which will help in finding two distinct largest numbers in case the same largest value is input more than once. It checks If the value of integers is not equal to largest1 value. As integers = 5 and  largest1 = 6 so this if condition is true. If this condition is not used in this program then largest2 will not be assigned distinct largest values but assigned 6 for both largest1 and largest2 as 6 is input twice. Next this if statement  largest2 = integers assigns value of integers to largest2 which is the second largest distinct integer.

Now the i is incremented by 1 integers value become 0.

while loop checks if integers!=0. As integers =0 so the while loop breaks. The last two print statements which produce following output.

The 1st largest distinct integer is: 6

The 2nd largest distinct integer is: 5

Write A Java Application With A Main() To Find The Two Largest Distinct Integers Entered On The Command

Related Questions

#Write a function called 'string_type' which accepts one #string argument and determines what type of string it is. # # - If the string is empty, return "empty". # - If the string is a single character, return "character". # - If the string represents a single word, return "word". # The string is a single word if it has no spaces. # - If the string is a whole sentence, return "sentence". # The string is a sentence if it contains spaces, but # at most one period. # - If the string is a paragraph, return "paragraph". The # string is a paragraph if it contains both spaces and # multiple periods (we won't worry about other # punctuation marks). # - If the string is multiple paragraphs, return "page". # The string is a paragraph if it contains any newline # characters ("\n"). # #Hint: think carefully about what order you should check #these conditions in. # #Hint 2: remember, there exists a count() method that #counts the number of times a string appears in another #string. For example, "blah blah blah".count("blah") #would return 3.

Answers

Answer:

I am writing a Python program:

def string_type(string):

   if string=="":  //if the string is empty

       return "empty"

   elif string.count(".")>1:  #if the period sign occurs more than once in string

       if string.count("\n"):  #checks if the new line occurs in the string

           return "page"  #if both the above cases are true then its a page

       return "paragraph"  # if the period sign condition is true then its a para

   elif string.count(" ")>=1:  #if no of spaces in string occur more than once

       return "sentence"  #returns sentence

   elif len(string)==1:  # if length of the string is 1 this

       return "character"  #returns character

   else:  #if none of the above conditions is true then its a word

       return "word" #returns word

Explanation:

def string_type(string):  this is the definition of method string_type which takes a string as argument and determines whether the type of string is a word, paragraph, page, sentence or empty.

if string=="" this if condition checks if the string is empty. If this condition is true then the method returns "empty"

elif string.count(".")>1  This condition checks if the string type is a paragragh

string.count(".")>1   and if string.count("\n") both statements check if the string type is a page.

Here the count() method is used which is used to return the number of times a specified string or character appears in the given string.

Suppose the string is "Paragraphs need to have multiple sentences. It's true.\n However, two is enough. Yes, two sentences can make a paragraph."

The if condition first checks if count(".")>1 which means it counts the occurrence of period i.e. "." in the string. If the period occurs more than once this means it could be a page. But it could also be a paragraph so in order to determine the correct string type another if statement if string.count("\n") inside elif statement determines if the string is a page or not. This statement checks the number of times a new line appears in the string. So this distinguishes the string type paragraph from string type page.

elif string.count(" ")>=1: statement determines if the string is a sentence. For example if the string is "i love to eat apples." count() method counts the number of times " " space appears in the string. If the space appears more than once this means this cannot be a single word or a character and it has more than one words. So this means its a sentence.

  elif len(string)==1:  this else if condition checks the length of the string. If the length of the string is 1 this means the string only has a single character. Suppose string is "!" Then the len (string) = 1 as it only contains exclamation mark character. So the method returns "character" . If none of the above if and elif conditions evaluates to true then this means the string type is a word.

Answer:

def string_type(string):

  if string=="":  //if the string is empty

      return "empty"

  elif string.count(".")>1:  #if the period sign occurs more than once in string

      if string.count("\n"):  #checks if the new line occurs in the string

          return "page"  #if both the above cases are true then its a page

      return "paragraph"  # if the period sign condition is true then its a para

  elif string.count(" ")>=1:  #if no of spaces in string occur more than once

      return "sentence"  #returns sentence

Explanation:

The following code uses a nested if statement.

if (employed == 'Y')
cout << "Employed!" << endl;

else if (employed == 'N')
cout << "Not Employed!" << endl;

else
cout << "Error!" << endl;

a. True
b. False

Answers

Answer:

true

Explanation:

else if used so I think it's true

6. A distribution consists of three components with frequencies 200, 250 and 300 having means
25,10, and 15 and standard deviations 3, 4, and 5 respectively.
Calculate
The mean?
The standard deviation?​

Answers

Answer:

The mean  = 16

The standard deviation = 7.19

Explanation:

N1 = 200  X1 = 25   σ1 = 3

N2= 250  X2 = 10   σ2 = 4

N3 = 300  X3= 15   σ3 = 5

The mean of a combined distribution is given by:

[tex]X = \frac{X_1N_1+X_2N_2+X_3N_3}{N_1+N_2+N_3}\\X = \frac{25*200+10*250+15*300}{200+250+300}\\X=16[/tex]

The differences from the mean for each component are:

[tex]D_1 = 25-16=9\\D_2=10-16=-6\\D_3=15-16=-1[/tex]

The standard deviation of a combined distribution is given by:

[tex]\sigma=\sqrt{\frac{N_1(\sigma_1^2+D_1^2)+N_2(\sigma_2^2+D_2^2)+N_3(\sigma_3^2+D_3^2)}{N_1+N_2+N_3}}\\\sigma=\sqrt{\frac{200(3^2+9^2)+250(4^2+(-6)^2)+300(5^2+(-1)^2)}{200+250+300}}\\\sigma=\sqrt{\frac{18000+13000+7800}{750} }\\\sigma=7.19[/tex]

The mean  = 16

The standard deviation = 7.19

A pen testing method in which a tester with access to an application behind its firewall imitates an attack that could be caused by a malicious insider.

a. True
b. False

Answers

Answer:

a. True

Explanation:

The statement that a pen testing method or penetration test in which a tester who has a means of entry to an application behind its firewall imitates an attack that could be caused by a malicious insider.

A penetration test, which is also refer to as a pen test, pentest or ethical hacking, is an approved simulated cyberattack done on a computer system, performed in order to evaluate the security of the system. The test is carried out to identify both weaknesses or vulnerabilities including the potential for unauthorized parties to penetrate to the system's features and data.

The main purpose of performing this test is to identify any vulnerability in a system's defenses which attackers may take advantage of.

"The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "

Answers

Question:

"The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "

A) a[0]..a[a.length]

B) a()

C) a

D) a[]  

Answer:

The correct answer is A.

An example is given in the attachment.

Cheers!

The best way to avoid driving impaired is to...
A. avoid drinking.
B. stay under the legal BAC limit.
C. keep a taxi fare on hand.

Answers

Answer:

the answer is A avoid drinking 10 Tips to Avoid Driving Drunk

Explanation:

Give someone your keys. Find someone trustworthy who isn't drinking and hand over your keys for the night. ...

Don't drink on an empty stomach. ...

Know your body and pace yourself. ...

Take public transit. ...

Spend the night. ...

Wait an hour or two. ...

Stop drinking 90 minutes before you plan to leave. ...

Take the night off from drinking. hope this helps you :)

What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(0)

Answers

Answer:

d) 0 1 1 2

The above piece of code prints the Fibonacci series.

Explanation:

def a(n):

   if n == 0:

       return 0

   elif n == 1:

       return 1

   else:

       return a(n-1)+a(n-2)

for i in range(0,4):

   print(a(i),end=" ")

Explain what a honeypot is. In your explanation, give at least one advantage and one disadvantage of deploying a honeypot on a corporate network.

Answers

Answer:

A honeypot is a computer network set up to act as a decoy to track, deflect, or research trying to obtain unwanted access to the information system.

Explanation:

A honeypot is a device or device network designed to imitate possible cyber-attack targets. It can be utilized to detect or deflect assaults from a legitimate military target. It may also be used to collect knowledge on how cybercrime works.

Advantage:-

Data Value:- One of the challenges faced by the research community is to obtain meaning from big data. Companies hold large quantities of data daily including firewall logs, device logs, and warnings for vulnerability scanning. Resources:- The problem facing most protection systems is resource shortages or even the depletion of resources. Power saturation is when a protection asset can no longer work since it is overloaded by its assets. Simplicity :- I find simplicity to be the biggest single strength of honeypots. No flashy techniques are to be created, no stamp computer systems to be managed, no rule units to be misconfigured.

Disadvantage:-  

That honeypot doesn't replace any safety mechanisms; they just operate with your overall security infrastructure and improve it.

What happens to weather patterns when a cold front approaches? What happens to
weather patterns when a warm front approaches?

Answers

Answer:

The overview including its problem is listed in the explanation segment following.

Explanation:

The cool, unobstructed front develops whenever the cool front overwhelms the warm side or front. The warm front increases over its colder, then gradually move towards the surface of the earth.

The subsequent weather system seems to be close to something like a moving warmer front.

So that the above seems to be the right answer.

Write a program that asks the user to input a positive integer and then calculates and displays the factorial of the number. The program should call a function named getN

Answers

Answer:

The program is written in python and it doesn't make use of any comment;

(See explanation section for line by line explanation)

def getN(num):

     fact = 1

     for i in range(1, 1 + num):

           fact = fact * i

     print("Factorial: ",fact)

num = int(input("Number: "))

if num < 0:

     print("Invalid")

else:

     getN(num)

Explanation:

The function getNum is defined here

def getN(num):

Initialize the result of the factorial to 1

     fact = 1

Get an iteration from 1 to the user input number

     for i in range(1, 1 + num):

Multiply each number that makes the iteration

           fact = fact * i

Print result

     print("Factorial: ",fact)

Ths line prompts user to input number

num = int(input("Number: "))

This line checks if user input is less than 0; If yes, the program prints "Invalid"

if num < 0:

     print("Invalid")

If otherwise, the program calls the getN function

else:

     getN(num)

Because Java byte code is the same on all computers, compiled Java programs Group of answer choices Cannot run on Linux systems Must be re-compiled for each different machine it is run on Are highly portable Are non-existent

Answers

Answer:

Are highly portable.

Explanation:

Java is a object oriented and class-based programming language. It was developed by Sun Microsystems on the 23rd of May, 1995.

Java was designed by a software engineer called James Gosling and it is originally owned by Oracle. Also, worthy of mention is the fact that Java was originally known as Oak.

Generally, Java as a software application usually are developed having a ".jar", ".class" or ".java" filename extensions.

Because Java byte code is the same on all computers, compiled Java programs are highly portable. This simply means that, the Java byte code was designed such that it has very few implementation dependency, thus, once the code is written, it can run on all computer platforms that supports the Java programming language.

Hence, the Java byte code is a write once, run anywhere software program.

The Java byte code instructions are read and executed by a computer program known as a Java Virtual Machine (JVM).

Additionally, Java program is used for developing varieties of applications such as, mobile, desktop, games, web and application servers etc.

It is always possible and feasible for a programmer to come up with test cases that run through every possible path in a program.
A. True
B. False

Answers

Answer:

True

Explanation:

It is always possible and feasible for a programmer to come up with test cases that run through every possible path in a program is a "true statement" or the first option. It is very natural for a programmer/developer to come up with test that will run through every possible outcome in a program. Doing so will help the developer find things that might cause problems with the program in later time.

Hope this helps.

The answer to the question about the feasibility of a programmer to always come up with test cases that run through every possible path in a program is:

No

What is a Test Case?

This refers to the set of actions which a programmer performs to find out if his software or program passes the system requirements in order to work properly.

With this in mind, we can see that while in some cases, it is possible for the programmer to come up with test cases, but it is not feasible in all cases as there can be hardware error which a virtual machine cannot solve.

Read more about test cases here:
https://brainly.com/question/26108146

A network technician is designing a network for a small company. The network technician needs to implement an email server and web server that will be accessed by both internal employees and external customers. Which of the following would best secure the internal network and allow access to the needed servers?
A. Implementing a site-to-site VPN for server access.B. Implementing a DMZ segment for the server.C. Implementing NAT addressing for the servers.D. Implementing a sandbox to contain the servers.

Answers

Answer:

Option A (Implementing a site-to-site VPN for server access) seems to be the correct choice.

Explanation:

A site-to-site configuration is something that a single Open VPN network links several more separate networks linked. Technologies through one network will access machines in all the other computer systems in that connection model, including conversely. Implementing this would be extremely straightforward, for as much further even though Access Server was indeed implicated.The much more challenging aspect happens when interacting regarding firewalls including privacy filtering methods, as well as modifying the forwarding table in internet gateways, as several of them from different manufacturers but instead prototypes which they may not be able to log many of these.This rather gateway device uses an Open VPN with a Linux VPN client, to create a connection between various channels. If someone's server hardware is also measured accurately then perhaps a site-to-site configuration could be accomplished which works straightforwardly throughout all systems in both cable systems.

Other choices are not related to the given instance. So that Option A would be the right one.

Select the option that is not true. 1. Timestamp and Validation schedulers are both optimistic schedulers. 2. Timestamp and Validation schedulers can be used to remove physically unrealizable behaviour. 3. Timestamp and Validation schedulers guarantee serializability. 4. Timestamp and Validation schedulers perform most effectively on transactions that perform writes.

Answers

Answer:

3. Timestamp and Validation schedulers guarantee serializability.

Explanation:

Timestamp is a sequence of information encoded when a certain event occurs at a given time that information is decoded and message is identified. Time schedulers is optimistic scheduler and it removes physically unrealizable behavior. Timestamp cannot guarantee serializability.  It can detect unrealizable behavior.

what kind of company would hire an information support and service employee?


-software development


-computer repair


-website development


-network administration

Answers

Answer:

it's a

Explanation:

A network technician is designing a network for a small company. The network technician needs to implement an email server and web server that will be accessed by both internal employees and external customers. Which of the following would BEST secure the internal network and allow access to the needed servers?
A. Implementing a site-to-site VPN for server access.
B. Implementing a DMZ segment for the server
C. Implementing NAT addressing for the servers
D. Implementing a sandbox to contain the servers

Answers

Answer:

(B) Implementing a DMZ segment for the servers

Explanation:

DMZ is the short form for Demilitarized Zone. It is the temporary storage between an internal or private LAN and the public Internet. The main purpose of the DMZ is to give additional layer of security to a company's LAN (Local Area Network).

Once there are services to be provided to users on the public Internet, such services should be added to the DMZ. A few services that are worth implementing a DMZ segment for are;

i. Email servers

ii. Web servers

iii. Proxy servers

iv. FTP servers

For each of these relations on the set {21,22,23,24},decide whether it is re- flexive, whether it is symmetric, whether it is antisymmetric, and whether it is transitive.1. {(22, 22), (22, 23), (22, 24), (23, 22), (23, 23), (23, 24)} 2. {(21,21),(21,22),(22,21),(22,22),(23,23),(24,24)}

Answers

Answer:

1. {(22, 22) (22, 23), (22, 24), (23, 22), (23, 23), (23, 24)} : Not reflective, Not symmetric, Not anti-symmetric, Transitive.

2.  {(21,21),(21,22),(22,21),(22,22),(23,23),(24,24)}: Reflective, symmetric.

Explanation:

Solution

Reflective: Of every element matched to its own element

Symmetric: For every (a,b) there should be (b,a)

Anti-symmetric: For every (a,b) there should not be (b,a)

Transitive: For every (a,b) ∈R and (b,c)∈ R -then (a,c) ER for all a, b, c ∈ A

Now,

1.{(22, 22) (22, 23), (22, 24), (23, 22), (23, 23), (23, 24)}

Not Reflective: This is because we don't have (21,21) (23,23) and (24,24)

Not symmetric: Because we don't have (23,24) and (24,23)

Not anti symmetric: We have both (22,23) and (23,22)

Transitive: It is either 22 or 23 be (a,b) and 24 (b,a)

2. {(21,21),(21,22),(22,21),(22,22),(23,23),(24,24)}

Reflective: For all we have (a,a)

Symmetric: For every (a,b) we have (b,a)

Not Anti-symmetric

Transitive

Create an application named ArithmeticMethods whose main() method holds two integer variables. Assign values to the variables. In turn, pass each value to methods named displayNumberPlus10(), displayNumberPlus100(), and displayNumberPlus1000(). Create each method to perform the task its name implies. Save the application as ArithmeticMethods.java.

Answers

Answer:

public class ArithmeticMethods

{

public static void main(String[] args) {

    int number1 = 7;

    int number2 = 28;

 displayNumberPlus10(number1);

 displayNumberPlus10(number2);

 displayNumberPlus100(number1);

 displayNumberPlus100(number2);

 displayNumberPlus1000(number1);

 displayNumberPlus1000(number2);

}

public static void displayNumberPlus10(int number){

    System.out.println(number + 10);

}

public static void displayNumberPlus100(int number){

    System.out.println(number + 100);

}

public static void displayNumberPlus1000(int number){

    System.out.println(number + 1000);

}

}

Explanation:

Inside the main:

Initialize two integers, number1 and number2

Call the methods with each integer

Create a method called displayNumberPlus10() that displays the sum of the given number and 10

Create a method called displayNumberPlus100() that displays the sum of the given number and 100

Create a method called displayNumberPlus1000() that displays the sum of the given number and 1000

Identify and write the errors given in the flowchart (with steps and flowchart) : Start ↓ Input A,B ↓ Average = (A + B + C) / 3 ↓ Print Average ↓ Stop

Answers

Answer:

i will send you the answers in the next 10minute

In the Programming Process which of the following is not involved in defining what the program is to do:_____________ Group of answer choices

a. Compile code
b. Purpose
c. Output
d. Input
e. Process

Answers

Answer:

a. Compile code

Explanation:

In programming process, the following are important in defining what a program is to do;

i. Purpose: The first step in writing a program is describing the purpose of the program. This includes the aim, objective and the scope of the program.  The purpose of a program should be defined in the program.

ii. Input: It is also important to specify inputs for your program. Inputs are basically data supplied to the program in order to perform a task. Valid inputs are defined in the program.

iii. Output: Many times, when inputs are supplied to a program the resulting effects are shown in the outputs. The way the output will be is defined in the program.

iv. Process: This involves the method by which inputs are being mapped into outputs. The process implements the functionality of the program by converting inputs into their corresponding outputs. The process is defined in the program.

Compile code is not a requirement in defining what a program is to do. It just allows the source code of the program to be converted into a language that the machine understands.

More than one component in a particular automotive electric circuit is not working. Technician A starts testing the circuit at the power source. Technician B starts testing the circuit at its load. Who is right?

Answers

Hi there! Hopefully this helps!

--------------------------------------------------------------------------------------------------

The answer is A, testing the circuit at the power source.

a. A hard disk has four surfaces (that's top and bottom of two platters). Each track has 2, 048 sectors and there are 131, 072 (2^17) tracks per surface. A block holds 512 bytes. The disk is not "zoned." What is the total capacity of this disk?

b. Given the disk in Part 1, how much data can be accessed without moving the disk heads. (That, is, what is the capacity of one cylinder?)

Answers

Answer:

Explanation:

Given that:

number of surfaces on a hard disk = 4

number of sectors = 2048 sectors

number of tracks per surface = 131, 072 (2^17)

a block holds 512 bytes.

Since, 'The disk is not "zoned.".....

then, Number of bytes / sector = 512

a) What is the total capacity of this disk?

The total capacity of the disk is:[tex]= 4 \ surfaces \times 131072 \dfrac{tracks}{surfaces} \times 2048 \dfrac{sector}{tracks} \times 512 \dfrac{bytes}{sector}[/tex]

[tex]= 5.49755814\times 10^{11} \ bytes[/tex]

= 549755814 KB ( kilobytes)

= 549755.814 MB (megabytes)

=549.755814  GB (gigabytes)

b. Given the disk in Part 1, how much data can be accessed without moving the disk heads. (i.e what is the capacity of one cylinder?)

The capacity of one cylinder can be estimated by determining the capacity of one surface and the capacity of one track.

The capacity of one surface = [tex]131072\dfrac{tracks}{surface} \times 2048 \dfrac{sector}{tracks} \times 512\dfrac{bytes}{sector}[/tex]

The capacity of one surface = [tex]1.37438953 \times 10^{11[/tex] byte = 137.44 GB

Capacity of one track = 2048 sectors/track × 512 bytes/sector

Capacity of one track = 1048576 Bytes/track

Capacity of one track =1048 KB/track

Capacity of one track ≅ 1 MB/track

Since the hard disk contains four surfaces

capacity of one cylinder = 1 MB/track × 4 track/cylinder

capacity of one cylinder  = 4 MB

Define stubs for the functions get_user_num) and compute_avg). Each stub should print "FIXME: Finish function_name" followed by a newline, and should return -1. Each stub must also contain the function's parameters Sample output with two calls to get_user_num) and one call to compute_avg): FIXME: Finish get_user_num() FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 1 ' Your solution goes here '' 2 4 user_num1 = 0 5 user_num2 = 0 6 avg_result = 0 7 8 user_num1 = get_user_num 9 user_num2 = get_user_num ) 10 avg_result = compute_avg(user_num1, user_num2) 11 12 print'Avg:', avg_result)|

Answers

Answer:

Here are the stub functions get_user_num() and compute_avg()

def get_user_num():

   print('FIXME: Finish get_user_num()')

   return -1  

def compute_avg(user_num1, user_num2):

   print('FIXME: Finish compute_avg()')

   return -1

Explanation:

A stub is a small function or a piece of code which is sometimes used in program to test a function before its fully implemented. It can also be used for a longer program that is to be loaded later. It is also used for a long function or program that is remotely located. It is used to test or simulate the functionality of the program.  

The first stub for the function get_user_num() displays FIXME: Finish get_user_num() and then it returns -1.

The seconds stub for the function compute_avg() displays the FIXME: Finish compute_avg() and then it returns -1.

Here with each print statement, there is function name after this FIXME: Finish line. The first function name is get_user_num and the second is compute_avg().

Next the function get_user_num() is called twice and function compute_avg() followed by a print statement: print('Avg:', avg_result) which prints the result. So the program as a whole is given below:

def get_user_num():

   print('FIXME: Finish get_user_num()')

   return -1  

def compute_avg(user_num1, user_num2):

   print('FIXME: Finish compute_avg()')

   return -1  

user_num1 = 0  # the variables are initialized to 0

user_num2 = 0

avg_result = 0  

user_num1 = get_user_num()  #calls get_user_num method

user_num2 = get_user_num()

avg_result = compute_avg(user_num1, user_num2)  

print('Avg:', avg_result)

The method get_user_num() is called twice so the line FIXME: Finish get_user_num() is printed twice on the output screen. The method compute_avg() is called once in this statement avg_result = compute_avg(user_num1, user_num2)   so the line FIXME: Finish compute_avg() is printed once on the output screen. Next the statement print('Avg:', avg_result) displays Avg: -1. You can see in the above program that avg_result = compute_avg(user_num1, user_num2)   and compute_avg function returns -1 so Avg= -1. The program along with the produced outcome is attached.

Assume that to_the_power_of is a function that expects two integer parameters and returns the value of the first parameter raised to the power of the second parameter. Write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.

Answers

Answer:

The statement in python is as follows:

to_the_power_of(cube_side,3)

Explanation:

As stated as the requirement of the code segment, the statement takes as parameters a variable cube_side and a constant 3.

It then returns the volume of the cube; i.e. cube raise to power 3

See full program below

def to_the_power_of(val,powe):

    result = val**powe

    print(result)

cube_side = float(input("Cube side: "))

to_the_power_of(cube_side,3)

The UNIX operating system started the concept of socket which also came with a set of programming application programming interface (API) for 'socket level' programming. A socket was also uniquely identified:

a. as the combination of IP address and port number to allow an application within a computer to set up a connection with another application in another computer without ambiguity.
b. the port number to clearly identify which application is using TCP.
c. IP address to make sure the Internet device using the socket is delineated.
d. the access network, such as Ethernet or Wi-Fi so that multiple LAN devices could be installed on a single computer.

Answers

Answer:

(a). as the combination of IP address and port number to allow an application within a computer to set up a connection with another application in another computer without ambiguity.

Explanation:

The explanation is in the answer.

A script sets up user accounts and installs software for a machine. Which stage of the hardware lifecycle does this scenario belong to?

Answers

Answer:

deployment phase

Explanation:

This specific scenario belongs to the deployment phase of the hardware lifecycle. This phase is described as when the purchased hardware and software devices are deployed to the end-user, and systems implemented to define asset relationships. Meaning that everything is installed and set up for the end-user to be able to use it correctly.

In the context of structured systems analysis and design (SSAD) models, a _____ is a tool that illustrates the logical steps in a process but does not show data elements and associations.

Answers

Answer:

Flowchart.

Explanation:

Structured Systems Analysis and Design (SSAD) is a methodology and a systems technique of analyzing and designing of information systems.

This system uses several tools to design various components such as dataflow diagram, conceptual data model, flowchart, etc.

In the given scenario, the tool that will be used by the system would be a flowchart.

A flowchart is a diagram that represents a systematic flow of a process. In SSAD, flowchart is used to illustrate the logical steps to be taken in a process but it does not show data elements and associations.

So, the correct answer is flowchart.

Shovels and Shingles is a small construction company consisting of 12 computers that have Internet access. The company's biggest concern is that a wily competitor will send e-mail messages pretending to be from Shovels and Shingles in order to get confidential information. Write down an encryption solution that best prevents a competitor from receiving confidential information and justify the recommendation.

Answers

Answer:

The Encryption solution that best prevents a competitor from receiving confidential information is the SSL(secure Socket Layer) Or TLS(Transport Layer Security).

Explanation:

Solution:

From my own perspective the encryption solution that i will use that prevents s a competitor from receiving confidential information and justify the recommendation is the SSL(secure Socket Layer) Or TLS(Transport Layer Security).

This is because in this case we have to share data confidentially (information need to be hidden from Unauthorized  security access. also these provides the Transport Layer security that we needed in above example above.

The purpose of these protocol is to provide server and client authentication, Data confidentiality,and Data integrity (protected from unauthorized change). Application Layer client/server program such as HTTP that uses the service of TCP can encapsulate their data in SSL Packets.

SSL (Secure Socket Layer): is defined as the normal technology for protecting an internet connection secure and defend any sensitive data that is being sent between two systems, and not allowing criminals from reading and changing any information sent, including potential personal details.

TLS (Transport Layer security): It is a procedure that allows  data integrity  and privacy over Internet communications.

What is computer engineering in your own words?

Answers

Answer: Computer engineering refers to the study that integrates digital engineering with computer sciences to design and develop computer structures and different technological gadgets.

Explanation:

Answer:

Computer engineering is the branch of engineering that integrates electronic engineering with computer sciences. Computer engineers design and develop computer systems and other technological devices.

The technology environment would include studies of family changes. social engineering. information technology. minimum wage laws. customer service.

Answers

Question:

The technology environment would include studies of:

A) family changes

B) social engineering

C) information technology

D) minimum wage laws

E) customer service

Answer:

The correct answer is Information Technology (C)

Explanation:

Information and communications technology (ICT) or Information Technology. Whenever the technology environment is under discourse, these are usually the predominant subject matter.

It doesn't come as a surprise given that we live in an information age. An era of the internet of things. If we are tending towards an era where every equipment and even most biological species will give off and receive data, then a technology environment is really predominantly IT.

Cheers!

Other Questions
How many different words can be formed with the letters AAAABBCCD (not necessarily meaningful words)?Please help me with this. Other answers did not work. Plsss help I will mark u as the Brainliest !! If unknown to you, your pipet was incorrectly calibrated so that it transferred less than 10.00 mL of your solution, the density you calculated for the liquid would tend to be smaller or larger than the correct value. Explain. debates on how girl child education is useless Which of the following describes the Enlightenment idea of natural law? The idea that people consent to government authority and in return the government protects their rights The idea that the will of the majority of people should make all decisions for the group The idea of dividing government powers into legislative, executive, and judicial branches The idea that there is a body of law said to come from nature that is common to all humans What is the length of Line segment B C?11234060 Find the the perimeter of triangle JKL find the value of x... Fred is making two rectangular flower beds.The dimensions of the larger rectangle will be three times the dimensions of the smallerrectangle.There is going to be the same depth of soil in each flower bed.Fred needs 180 kg of soil for the smaller flower bed.Work out how much soil Fred needs for the larger flower bed. ASAP 20 PTS What other areas of cultural diversity besides religion, interpersonal behavior, and family organization influence the way healthcare providers interact with patients? festivals language social experiences artistic expression A flat polished area is turned through 15 degrees. If the angle of incidence is 20 degrees, what is the angle between the incident ray and the reflected ray of the turned surface? Which of the following is an example of an institution linking the government with the people?A. MediaB. Election C. Political parties D. All of these are examples of institutions the link the government with the people. The main idea that Madison addresses in this passage is why the US government 31.7+42.8+26.4+x/4=39.1 100.9+x/4 What happens when you increase the number of slits per millimeter (decrease the spacing between slits)? which molecule loses electrons during cellular respiration? Please help! It is Geometry a person lifts 4.5kg block up a vertical distance of 1.2meters and then carries it horizontally for 7.3meters. Calculate the Total Work done by the person and the block. Boiling point of water at 750 mmHg is 99.63C. How much sucrose is to be added to 500 g of water such that it boils at 100C. Kb for water 0.52 K Kg mol-1 ga political candidate has asked you to conduct a poll to determine what percentage of people support her. if the candidate only wants a 8% margin of error at a 95% cnofidence level, what size of sample is needed