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 the packets exchanged in TCP connection setup between Host A and Host B. Assume that Host A's initial sequence number i
Rasek [7]

Answer:

I think that part C correct option

6 0
2 years ago
Which one of the following word processing features saves you the most time when keying a document?
drek231 [11]
C) find and replace which finds the words you want to replace in a document and replaces them to whatever you specify
3 0
3 years ago
A ____ firewall keeps a record of the state of a connection between an internal computer and an external device and then makes d
Yakvenalex [24]

Answer:

Stateful frame filtering

Explanation:

<h2><u>Fill in the blanks</u></h2>

A <u>Stateful frame filtering </u> keeps a record of the state of a connection between an internal computer and an external device and then makes decisions based on the connection as well as the conditions.

8 0
3 years ago
Exporting data is sending data to a new file. true or false
dolphi86 [110]
False__________________________
8 0
3 years ago
Read 2 more answers
The Hazard Communication Standard, commonly called the “Right-to-Know” law, gives you the right to know what information?
statuscvo [17]
Lets you know if their are any certain hazards or messes on the property like mold or ants
8 0
3 years ago
Other questions:
  • What formatting option is easiest to read when printed out
    12·1 answer
  • Which command should you enter to configure a single port to discard inferior bpdus 200-125?
    5·1 answer
  • Different video files and ______ can cause compatibility issues to arise between computer systems.
    8·1 answer
  • Now tell me how be rich like Bill Gates
    6·1 answer
  • What are finger nails made of?-
    12·2 answers
  • Which procedure is used as a physical barrier to secure data against unauthorized access in a cloud storage data center?
    6·1 answer
  • Write an HTML document which contains two text fields, a button, and a div. The first text field should be labeled “Temperature”
    10·1 answer
  • Can someone please help me to point out what's wrong with this C program:
    13·1 answer
  • This is a bit confusing to me. Could someone please help me! I have to use CSS to Design a Web Page. I will mark Brainliest!
    8·1 answer
  • PLEASE HELP How have phones made us spoiled? How have phones made us unhappy?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!