Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using the Java Part 1 You are designing an interface for an autopilot system on a commercial aircraft. Define interface AutoPilotInterface with the following methods:
using the Java
Part 1 You are designing an interface for an autopilot system on a commercial aircraft. Define interface AutoPilotInterface with the following methods: setSpeed setHeading setAltitude startAutoPilot stopAutoPilot Choose appropriate parameters and return type. Speed is specified in knots, heading in degrees and altitude in ft. Define a class BoeingAutoPilotControl that implements AutoPilotInterface. BoeingAutoPilot Control has instance variables that store speed, heading and altitude. Then define a class AirbusAutoPilot Control that implements AutoPilot Interface. AirbusAutoPilot Control adds a method convertionRate which takes in input the ratio (1 mph)/(1 knot), which defaults to 0.868976. It stores the speed in mph and prints speed, altitude and heading once all three have been provided (regardless of the order) (Take a look at Part 4 for testing. You may want to start defining class TestAutoPilot now) Part 2 Define exceptions SpeedTooLOWException, InvalidHeadingException and InvalidAltitudeException. The first is triggered when the speed is set below 200 knots; the second is thrown when the heading is not between 0 and 359; the third is raised when the altitude is not between 20000 and 38000 ft. Add appropriate fields and methods if needed, and report the offending value when getMessage is invoked (do not redefine getMessage). Do not change the autopilot code yet. Part 3 Use exceptions from Part 2 in AirbusAutoPilot Control and BoeingAutoPilot Control. Do not catch them in set Speed, setHeading and setAltitude. Part 4 Define class TestAutoPilot, which has the main method. Read speed, heading and altitude from the user. Create an array of two elements, and use it to store and test one instance of AirbusAutoPilotControl and one instance of BoeingAutoPilotControl. For BoeingAutoPilotControl, read the conversion rate between mph and knots from the user. If the user enters a negative value, do not change the defaultStep 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