class Runner
{
double max_speed;
double acceleration;
double velocity;
double distance;
public Runner(double max_speed, double
acceleration)
{
this.max_speed = max_speed;
this.acceleration =
acceleration;
}
double ComputeDistance(double time)
{
double velocity_temp;
if(this.acceleration * time >
this.max_speed)
{
velocity =
this.acceleration * time;
}
else
{
velocity =
this.max_speed;
}
this.distance = velocity *
time;
return this.distance;
}
public static void main(String args[])
{
Runner Nelly = new Runner(30.0,
8.0);
Runner Steve = new Runner(8.8,
3.0);
double max_acceleration1 =
Nelly.acceleration;
double max_acceleration2 =
Steve.acceleration;
System.out.println("Runner \t max
Speed(f/s) \t Acceleration(f/s/s)");
System.out.println("Nelle \t
"+Nelly.max_speed+" \t \t \t"+Nelly.acceleration);
System.out.println("Steve \t
"+Steve.max_speed+" \t \t \t"+Steve.acceleration);
System.out.println("Time \t Nelly
\t Steve");
int flag1 = 0,flag2 = 0;
for(int i = 0; i < 30;i++)
{
if(i%5 ==
0)
{
if(Nelly.distance >= 600
&& flag1 == 0)
{
Nelly.acceleration = 0;
flag1 =
1;
}
else
{
Nelly.acceleration = max_acceleration1;
}
if(Steve.distance >= 600
&& flag2 == 0)
{
Steve.acceleration = 0;
flag2 =
1;
}
else
{
Steve.acceleration = max_acceleration2;
}
System.out.println(i+"\t"+Nelly.ComputeDistance(i)+"\t"+Steve.ComputeDistance(i));
}
}
}
}
If you have any doubts please comment and please don't dislike.
in java Program 0: Due 9/3 A track coach wants to predict where her runners are...
12-10. Car A starts from rest at t-0 and travels along a straight road with a constant acceleration of 3 m/s until it reaches a speed of 27 m/s. Afterwards it maintains this speed. Also, when-0, car B located 2000 m down the road is traveling towards A at a constant speed of 20 m/s. Determine the distance travelled by car A when they pass each other. 20 m/s 2000 m 12-11. A particle travels along a straight line with...
Assignment 9 If you run around a half-mile track twice in 20 minutes a. What is the total distance traveled? b. What is the speed in mi/hr (show work)? c. What is the total displacement? d. What is the velocity in mi/hr? You travel east 2 miles and then turn to the north and walk another 3 miles. What is your displacement (show work, make sure to show the direction as well)? You travel 6 miles at 40 degrees. How...
Instructions for PHY 2048 Problem Set (PSET): (1) Please NEATLY write your name and your solutions. (2) You must use blank 8"x11" printer paper. (3) Begin each problem on a new page, and put your name on each page. Staple your pages together. 4) Only write on one side of the page. (5) You must write up your solutions independently (i.e. don't copy anyone else's solutions), using your own words and thought process. You must show all of your work....
Homework-2 – Working with a class. Problem: Attached with this homework is code for a class called DroppedObject. This class is used to to store the state of a falling object. The problem this class/object can be used to solve is detailed below. Your task for this homework is to read and understand the attached class. Note this class is formatted like all classes should be with private variables, constructors, a toString method, getter and setter methods, and other relevant...