1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
stiks02 [169]
3 years ago
11

Using the scenario below, answer the following questions:

Computers and Technology
1 answer:
4vir4ik [10]3 years ago
3 0

Answer:

Here is code in java.

import java.util.*;

class Main

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

         boolean flag=false;

         int total_mile=0;

         double avg_mile;

       // part 1, create and initialize array

       int inp[]={2,5,9,11,13,17,20,22,24,26};

       

       System.out.print("miles ran per week: ");

       // print the miles per week of train

       for(int x=0;x<10;x++)

       {

       System.out.print(inp[x]+" ");

       }

        System.out.println();

       //part 2, print the value of index 2 in the list

       System.out.println("value at index 2: "+inp[2]+" miles");

       //part 3, find length of array

       System.out.println("list length: "+inp.length);

     

       // part 4, calculate total mile and average

       for(int y=0;y<10;y++)

       {

       total_mile=total_mile+inp[y];

       }

       System.out.println("total miles ran: "+total_mile+" miles");

       

       avg_mile=total_mile/10.0;

       System.out.println("average no of miles ran= "+avg_mile+" miles");

       

     // part 5, check 4 exist in the list or not

       for(int k=0;k<10;k++)

       {

       if(inp[k]==4)

       {

       flag=true;

       break;

           }

       }

           if(flag)

           System.out.println("4 exist in the list.");

           else

            System.out.println("4 doesn't exists in the list.");  

       

   }catch(Exception ex){

       return;}

}

}

Explanation:

Create and initialize array with list value equals to 2 and maximum value 26. Print the miles of each week.Then find the value of miles at index 2 in the list.Next find the length of the array and print it.Calculate total miles ran of 10 weeks.Then calculate the average miles by dividing the total with 10. In the array, check 4 exist or not.

Output:

miles ran per week: 2 5 9 11 13 17 20 22 24 26                                                                            

value at index 2: 9 miles                                                                                                  

list length: 10                                                                                                            

total miles ran: 149 miles                                                                                                

average no of miles ran= 14.9 miles                                                                                        

4 doesn't exists

You might be interested in
Consider a multidimensional array A stored in row-major order with 22 rows and 6 columns whose subscripts start at 0. If each el
siniylev [52]

Answer:

Option c is the correct answer for the above question.

Explanation:

  • If the array will store in row-major order, then it will be a store like the first row, then second row and then third row.
  • If the user wants to conclude the address of the A[3,5], then the address of the A[3,5] will be 184.
  • It is because the 3 states the row number and the 5 states the column number.
  • The above question states that every value take 8 bit. and there are 4 rows from 0 to 3 and 6 column (0 to 5) for every row (except the fourth rows because it takes 5 columns from 0 to 4) before the A[3,5].
  • So there are 23 value before A[3,5] which are as-- [00,01,02,03,04,05][10,11,12,13,14,15][20,21,22,23,24,25][30,31,32,33,34].
  • So when every value takes 8 bit then 23 value takes 184 bits(23*8).
  • So the address of A[3,4] is 184.
  • Hence option c is the correct and the other is not because of 184 stated from the c option only.
4 0
3 years ago
1)What is the hydropower resources/energy?
s344n2d4d5 [400]

Answer:

.

Explanation:

.

6 0
3 years ago
Jason needs to design the colors for a web site that make it easy to read. Which should he consider using?
ololo11 [35]

Answer: Dark background and light text.

Explanation:

Assuming when you mean by "light text", you mean by white text. This should be able to be readable by users visiting the site.

4 0
3 years ago
The text between and defines the _____.
Genrish500 [490]
Active text on a page
5 0
2 years ago
Help pls<br> cmu cs 0<br> 4.1.2.1 Creating Groups checkpoint 1
Sindrei [870]

Answer:

Explanation:

Circle(centerX, centerY, radius, fill='black', border=None,

borderWidth=2, opacity=100, rotateAngle=0, dashes=False,

align='center', visible=True)

8 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is a goal of paraphrasing​
    12·1 answer
  • A circuit contains three resistors connected in series. the value of r1 is 150 , the value of r2 is 60 , and the value of r3 is
    8·2 answers
  • Write a Student class in Java which has a name, id_number, year (e.g. 2) and
    9·1 answer
  • One common method of converting symbols into binary digits for computer processing is called ASCII​ (American Standard Code of I
    5·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • You are system administrator with hundreds of host workstations to manage and maintain. You need to enable hosts on your network
    14·1 answer
  • What is project scope? a. Quantifiable criteria that must be met for the project to be considered a success b. Products, service
    5·1 answer
  • Which category does this fall in identity theft​
    6·1 answer
  • In English there are five vowel letters in the alphabet: A, E, I, O, U. For the purposes of this exercise we won't count Y as a
    5·1 answer
  • Jason is the motion picture projectionist at the local IMAX theater. This means that he runs the huge movie projector so that cu
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!