Question: What input was given to the following code snippet to output 2 ? Scanner s = new Scanner ( System . in ) ; int

What input was given to the following code snippet to output 2?
Scanner s = new Scanner(System.in);
int times;
times = s.nextInt(); //brings in an int from commandline
times = times <0?-times : times;
Objective 1(50%):
You are to take the given code which shows 1 car running a race. Your job will be to add 5 more cars with varying stats which should participate in the race just like the first car. In this lab each car holds the same types of information, behaves in the same way and only differs in their values for said information. So the optimal solution would be an object to hold the cars information as well as the behaviors the car undertakes. Create an object capable of holding the information for each car. Include also the operations that the cars do as methods (functions). Make certain to create a constructor that takes, as input, adequate information to allow you to build the cars more easily.
String car2Name = "Pat Sajak Car";
car2HandlingS =0.45f;
car2HandlingC =0.65f;
car2HandlingU =0.3f;
car2RaceProgress =0;
car2CurrentSpeed =0;
car2TopSpeed =0.75f;
car2Acceleration =0.08f;
car2Wins =0;
car2Symbol ='P';
String car3Name = "Alex Trebek Car";
car3HandlingS =0.29f;
car3HandlingC =0.55f;
car3HandlingU =0.02f;
car3RaceProgress =0;
car3CurrentSpeed =0;
car3TopSpeed =0.83f;
car3Acceleration =0.19f;
car3Wins =0;
car3Symbol ='A';
String car4Name = "Bob Eubanks Car";
Car4HandlingS =0.15f;
Car4HandlingC =0.20f;
Car4HandlingU =0.03f;
Car4RaceProgress =0;
Car4CurrentSpeed =0;
Car4TopSpeed =0.9f;
Car4Acceleration =0.21f;
Car4Wins =0;
Car4Symbol ='D';
String car5Name = "Steve Harvey Car";
Car5HandlingS =0.20f;
Car5HandlingC =0.22f;
Car5HandlingU =0.05f;
Car5RaceProgress =0;
Car5CurrentSpeed =0;
Car5TopSpeed =0.92f;
Car5Acceleration =0.19f;
Car5Wins =0;
Car5Symbol ='H';
String car5Name = "Richard Dawson Car";
Car5HandlingS =0.40f;
Car5HandlingC =0.5f;
Car5HandlingU =0.35f;
Car5RaceProgress =0;
Car5CurrentSpeed =0;
Car5TopSpeed =0.675f;
Car5Acceleration =0.19f;
Car5Wins =0;
Car5Symbol ='R';
Objective 2(25%):
Right now the race is only being run once. Adjust the code so that the race can be run 25 times to simulate an entire season. At the end of the season the car with the most wins should be output along with the race wins total.
Objective 3(25%):
Each race of the season should be a different race. Randomly create racetracks prior to the start of each race. Do this by randomly appending the four characters to a string. You can skew the random numbers to give more strait-aways or turns depending on your preference (so long as there is a chance of any type of race track being possible). int notes = times++;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!