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
seropon [69]
3 years ago
9

Summary

Computers and Technology
1 answer:
Nataly_w [17]3 years ago
8 0

Answer:dddd

Explanation:

//The code is all written in Java and here are the three classes in order ReportDriver, RaceReport, and Race

class ReportDriver {

   

   public static void main(String[] args) {

       boolean continueRace = true;

       Scanner in = new Scanner(System.in);

       ArrayList<ArrayList<Integer>> races = new ArrayList<>();

       while (continueRace == true) {

           System.out.println("Would you like to enter into a race? Y or N");

           char answer = in.next().toLowerCase().charAt(0);

           if (answer == 'y') {

               Race race = new Race();

               races.add(race.Race());

           } else {

               break;

           }

       }

       for (int x = 0; x <= races.size()-1; x++) {

           RaceReport report = new RaceReport();

           report.RaceReport(races.get(x));

           report.printRange();

           report.printAverage();

       }

   }

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

package sample;

import java.util.ArrayList;

public class RaceReport {

   int range, average;

   String first, second, third;

   public void RaceReport(ArrayList<Integer> times) {

       if (times.get(2) == times.get(1)) {

           if (times.get(2) == times.get(0)) {

               System.out.println(first = "Times tied for first place are " + times.get(2) + " and " + times.get(1) + " and " + times.get(0));

           } else {

               System.out.println(first = "Times tied for first place are " + times.get(2) + " and " + times.get(1));

               System.out.println(second = "Second place time is " + times.get(0));

           }

       } else if (times.get(1) == times.get(0)) {

           System.out.println(first = "First place time is " + times.get(2));

           System.out.println(second = "Times tied for Second place are " + times.get(1) + " and " + times.get(0));

       } else {

           System.out.println(first = "First place time is " + times.get(2));

           System.out.println(second = "Second place time is " + times.get(1));

           System.out.println( third = "Third place time is " + times.get(0));

       }

       range = Math.abs(times.get(0) - times.get(2));

       average = (times.get(2) + times.get(1) + times.get(0) / 3);

   }

   public void printRange() {

       System.out.println("The range of the race was " + range);

   }

   public void printAverage() {

       System.out.println("The average of the race was " + average);

   }

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

package sample;

import java.util.ArrayList;

import java.util.Collections;

import java.util.Scanner;

public class Race {

   Scanner in = new Scanner(System.in);

   ArrayList<Integer> times = new ArrayList<>();

   public ArrayList<Integer> Race() {

       System.out.println("Input time 1:");

       times.add(in.nextInt());

       System.out.println("Input time 2:");

       times.add(in.nextInt());

       System.out.println("Input time 3:");

       times.add(in.nextInt());

       Collections.sort(times);

       return times;

   }

}

You might be interested in
explain in detail how such a company can improve the focus and relationship with customers, and what they will benefit from this
Reil [10]
Advertisement maybe
6 0
3 years ago
How do you know how much space is on the computer
Vladimir79 [104]
Depending on which computer you have you can go into settings and check the data tab or it should be on the box how much it comes with :)
5 0
3 years ago
Read 2 more answers
Give three facts about the history of the train shongololo
monitta
<span>began operating in 1995
shongololo means </span><span> “to roll up”
non- profit organization </span>
3 0
3 years ago
Similarities between human and computer​
Zielflug [23.3K]

Answer: Both have a center for knowledge; motherboard and brain. Both have a way of translating messages to an action. Both have a way of creating and sending messages to different parts of the system.

5 0
3 years ago
Which of the following is an accurate explanation of what this paragraph means?
LuckyWell [14K]

Answer:

fifty five years later he burned out the same person who had to go and he said that the same person you met in a long period and I have been on my side and you know what I mean to him but she is the one I want her out and then she has a good time for me to get to the point where I don't know her I would have

4 0
3 years ago
Other questions:
  • Assume that the variables gpa, deansList and studentName, have been declared and initialized . Write a statement that both adds
    6·1 answer
  • 5. Why would you want to wear white or light colors on a summer day?
    5·1 answer
  • Suppose an instruction takes 4 cycles to execute in an unpipelined CPU: one cycle to fetch the instruction, one cycle to decode
    10·1 answer
  • HURRY UP NEED HELP!!! What are examples of curricular education? Check all that apply.
    9·2 answers
  • Please answer this I know that no one else does but I can't think right now
    10·1 answer
  • What is the Matlab command to create a column vector with 11 equally spaced elements, whose first element is 2 and whose last is
    8·1 answer
  • An alteration threat violates information integrity. <br> a. True <br> b. False
    13·1 answer
  • Which is not one of the four criteria for proving the correctness of a logical pretest loop construct of the form: while B do S
    14·1 answer
  • They have outlined their technical needs and have sent some of the documentation along with the potential provider's SLAs and te
    14·1 answer
  • Assume that class BankAccount exists, and that it has a constructor that sets the private field balance, and that setBalance and
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!