• 100% Satisfaction Guarantee
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
20870358
R.R. Jha is online now

# Programming

The FAA has recently come under fire for not establishing better technologies to save the lives of passengers on flights unfortunate enough to experience mid-air collisions. These mid-air collisions are the result of distance closing faster than the airplane can be made to react. A brilliant aerospace engineer has designed a passenger jet that constantly monitors radar signatures for input. It calculates the distance between the plane and any other objects within the plane's area of concern up to 3 miles away. Though the plane is agile, it has a threshold of a 10s reaction time. That is to say, the plane can be made to safely avert an object it's headed for collision with so long as it has at least 10s to react. If the pilot has not reacted within 20s the system begins to prepare itself to react on behalf of the pilot. If the plane cannot react by averting disaster, it will eject all 400 passengers from their seats in a safe "cocoon-like" pod that drifts to the earth below using parachutes. That is to say, if for some reason the time to react, based on the plane's speed and object's speed is too short to avert a collision, the plane will launch an escape sequence to save the passengers. Your job is to write a program that receives distance and speed values for the plane and the closest moving object to the plane. The program must calculate the time to impact. If the time to impact, based on the parameters above, is less that 10s then the program will signal the plane to launch the passengers to safety. I need help doing the psuedocode, flowchart and the source code to create this program. I have tried to do them and am getting it wrong. Please help.

the code i have come up with is

public class Plane {

public static void main(String[] args) {

double distance, planeSpeed, objectSpeed;
double timeToCollision;

Scanner input = new Scanner(System.in);
System.out.print("Enter distance of nearest object: ");
distance = input.nextDouble();
System.out.print("Enter speed of the plane: ");
planeSpeed = input.nextDouble();
System.out.print("Enter speed of the object: ");
objectSpeed = input.nextDouble();

timeToCollision = distance / (planeSpeed + objectSpeed);

if (timeToCollision >= 10) {
System.out.println("\nAvert object!");
} else {
System.out.println("\nEject passengers!");
}

but it gives me errors and won't compile. I use Ideone.com

Hello and welcome back!

Seems like the issue isn't completely solved. I'll try to make a video/screenshots of how to run it on Ideone and send to you. That should clarify everything.
Customer: replied 3 years ago.

Ok, thank you