Answered step by step
Verified Expert Solution
Question
1 Approved Answer
An airplane's actual speed is determined by the speed of the plane and the windspeed. If a plane's speed is 500 mph and it has
An airplane's actual speed is determined by the speed of the plane and the windspeed. If a plane's speed is 500 mph and it has a trailing windspeed of 50mph, the actual speed of the plane is 500 + 50 = 550 mph. If the plane's speed is 500 mph and it has a head windspeed of 50 mph then the planes actual speed is 500 - 50 = 450 mph. Alaska Airlines wishes to write a program that will take the plane's speed, the windspeed, the distance to the destination airport, and the expected arrival time to determine if the plane will land on time. You can figure this out by dividing the distance to the destination by the actual speed of the aircraft. For example, if the plane is 1000 miles from its destination and its actual speed is 550mph, it would take 1000/550 = 1.818 hours to land. If the expected arrival time is 2 hours then the plane will be not be on time. Assume that the following code segment appears in a class other than PlaneSchedule. The code segment shows an example of using the PlaneSchedule class to determine if two different planes are on time. PlaneSchedule plSchedule = new Plane Schedule (500.0, 50.0, TRAILING); double actualSpeed = pischedule.getActualSpeed(); // actualSpeed is assigned to 550... Boolean onTimel = plSchedule. isOnTime (1000.0, 2.0); // true because 1000.0/actualSpeed 2.0. Write the PlaneSchedule class. Your implementation must include a constructor that includes the following parameters, double airspeed, double windspeed, and boolean direction. Assume that the units will be in miles for distance and hours for time. You may assume that the values passed in for distance and speed will always be positive. You will need to define appropriate values for the HEAD and TRAILING constants. Note: These constants will need to be static fields in the PlaneSchedule class. Your class must produce the indicated results above when invoked by the code segment above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started