Choose the best collection for each situation.You need to keep a record of the ages of the last 50 customers visit a restaurant. As new customers come in you delete the age that has been in the list the longest.

You need to store the GPS coordinates of the hospitals in a state in order to find the nearest hospital for ambulance helicopters.

You write a loop to save anywhere from 10 to 100 values from a user. You will pass the collection to a function to find the average.

Answers

Answer 1
Answer:

Answer:

Deque: You need to keep a record of the ages of the last 50 customers visit a restaurant. As new customers come in you delete the age that has been in the list the longest.

Tuple: You need to store the GPS coordinates of the hospitals in a state in order to find the nearest hospital for ambulance helicopters.

List: You write a loop to save anywhere from 10 to 100 values from a user. You will pass the collection to a function to find the average.

Explanation: Just got the results back no thanks to the guy above


Related Questions

Why is OS important in every data processing system? Please Answer Fast! ​
Write a program that declares variables named init1, init2, and init3, to hold your three initials. Display the three initials with a period following each one, as in J.M.F.
3. What is the error in the following pseudocode? // The searchName function accepts a string containing the name // to search for, an array of strings containing the names, and // an integer specifying the size of the array. The function // searches for the name in the array. If the name is found, the // string containing the name is returned; otherwise a message // indicating that the name was not found in the array is // returned. Function String searchName(String name, String names[], Integer size) Declare Boolean found Declare Integer index Declare String result // Step through the array searching for the // specified name. While found == False AND index <= size − 1 If contains(names[index], name) Then Set found = True Else Set index = index + 1 End If End While // Determine the result. If found == True Then Set result = names[index] Else Set result = "That name was not found in the array." End If Return result End Function
.Although SQL is a language, you donât use it to write applications? (true, false)
Most new information systems must communicate with other, existing systems, so the design of the method and details of these communication links must be precisely defined. These are called ____.

Write a program that reads in 10 numbers from the user and stores them in a 1D array of size 10. Then, write BubbleSort to sort that array – continuously pushing the largest elements to the right side

Answers

Answer:

The solution is provided in the explanation section.

Detailed explanation is provided using comments within the code

Explanation:

import java.util.*;

public class Main {

//The Bubble sort method

public static void bb_Sort(int[] arr) {  

   int n = 10; //Length of array  

   int temp = 0; // create a temporal variable  

   for(int i=0; i < n; i++){  

         for(int j=1; j < (n-i); j++){  

           if(arr[j-1] > arr[j]){  

               // The bubble sort algorithm swaps elements  

               temp = arr[j-1];  

               arr[j-1] = arr[j];  

               arr[j] = temp;  

             }  

         }            

         }  

        }

 public static void main(String[] args) {

   //declaring the array of integers

   int [] array = new int[10];

   //Prompt user to add elements into the array

   Scanner in = new Scanner(System.in);

   //Use for loop to receive all 10 elements

   for(int i = 0; i<array.length; i++){

     System.out.println("Enter the next array Element");

     array[i] = in.nextInt();

   }

   //Print the array elements before bubble sort

   System.out.println("The Array before bubble sort");

   System.out.println(Arrays.toString(array));

   //Call bubble sort method

   bb_Sort(array);  

               

   System.out.println("Array After Bubble Sort");  

   System.out.println(Arrays.toString(array));

 }

}

Our favorite program runs in 10 seconds on computer A, which has a 2 GHz clock. We are trying to help a computer designer build a computer, B, which will run this program in 6 seconds. The designer has determined that a substantial increase in the clock rate is possible, but this increase will affect the rest of the CPU design, causing computer B to require 1.2 times as many clock cycles as computer A for this program. What clock rate should we tell the designer to target?

Answers

Clock rate is simply the number of clock cycles a computer can perform in a second

Computer B should be designed to have a clock rate of 4GHz

The given parameters are:

\mathbf{t_A = 10s} --- time on computer A

\mathbf{c_A = 2GHz} --- computer A clock

\mathbf{t_B = 6s} --- time on computer B

Start by calculating the period of computer A

\mathbf{T_A = (1)/(c_A)}

So, we have:

\mathbf{T_A = (1)/(2GHz)}

Rewrite as:

\mathbf{T_A = (1)/(2 * 10^9 Hz)}

So, we have:

\mathbf{T_A = 0.5 * 10^(-9) s}}

Next, we calculate the required number of clocks on computer A

\mathbf{n_A = (t_A)/(T_A)}

So, we have:

\mathbf{n_A = (10)/(0.5 * 10^(-9))}

\mathbf{n_A = 20 * 10^(9)}

Computer B requires 1.2 times as many clock cycles as A.

So, we have:

\mathbf{n_B = 1.2 * n_A}

This gives

\mathbf{n_B =1.2 * 20 * 10^(9)}

\mathbf{n_B =24 * 10^(9)}

The clock period of computer B is:

\mathbf{T_B = (t_B)/(n_B)}

So, we have:

\mathbf{T_B = (6)/(24 * 10^(9))}

\mathbf{T_B = 0.25 * 10^(-9)}

Lastly, the clock rate of computer B is:

\mathbf{c_B = (1)/(T_B)}

\mathbf{c_B = (1)/(0.25 * 10^(-9))}

\mathbf{c_B = 4 * 10^(9)}

Express in gigahertz

\mathbf{c_B = 4 GHz}

Hence, computer B should be designed to have a clock rate of 4GHz

Read more about clock rates at:

brainly.com/question/14241825

Answer:

4 GHz

Explanation:

Time taken for computer A to execute the program is = 10 secs

Given frequency of the clock for computer A is = 2 GHz

We know Clock period = 1 / frequency = 1 / 2 * 109 = 0.5 ns

Number of clocks requried to execute the program in computer A is

= Total Execution time / clock period = 10 / 0.5 * 10-9 = 20 * 109 clocks

Given Time taken for computer B to execute the program is = 6 secs

Given computer B requries 1.2 times as many clocks as computer A

implies number of clocks to execute program in computer B = 1.2 * 20 * 109 = 24 * 109

Here clock period of computer B = Total execution time / number of clocks

                               = 6 secs / 24 * 109

                               = 0.25 ns

Hence clock rate = frequency is = 1 / clock period = 1 / 0.25 ns = 4 GHz.

An objective function in linearprogramming is a(n):decisionvariable.
environmentvariable.
resultvariable.
independentvariable.
constant.

Answers

Answer: An objective function in linear programming is a decision variable.

Explanation: An objective function is a function which has the target towards the model whether it should be maximized or minimized according to the relation between the  variables present in the function. There are set of variables which are responsible for the controlling of objective function that is known as decision variables.

In a company you are in charge of system maintainance. Justify with 5 reasons why your role is key

Answers

Answer:

As u are the in charge of system maintainance u have to maintain safety and security to the system.as the system maintainance is a very big role and u can say it is the key to ur company or to ur work.

. A file allocation table (FAT) is used to keep track of the portions assigned to a file. Select one: True False

Answers

Answer: True

Explanation: File allocation table(FAT) is the part of the file system that helps the hard drives .It is used for the management of the files and data which gets stored in the hard drive  by the operating system. It can also help in the extension or expansion of the hard drive storage.

It also keeps tracing the files and data accordingly. This table works for the  portable devices ,cameras etc. Thus, the statement given is true.

The advantages of automation include: (I) reduced output variability. (II) reduced variable costs. (III) machines don't strike or file grievances. (IV) machines are always less expensive than human labor.

Answers

Answer:

(III) machines don't strike or file grievances.

(IV) machines are always less expensive than human labor.

Explanation:

The advantage of automation among the option is:

(III) machines don't strike or file grievances - Machine has the advantage of not going on strike or filing grievances. It just obey instruction. Strike are human way of showing grievances. With automation, there is no issue of strike or filing for grievance.

(IV) machines are always less expensive than human labor - Machines as a means of automation are very cheap when compared to human labor. The only added cost for machine is the added cost after the cost of purchase. For human labor, the cost is not fixed or predictable.

Other Questions