Question: Write a C + + class for an airplane. The Airplane class should have three data members: type of airplane (character array of SIZE 50),
Write a C + + class for an airplane. The Airplane class should have three data members: type of airplane (character array of SIZE 50), current flying speed, and maximum flying speed (both of type double). The class should have the following methods: Airplane(): The default constructor set_type(): Assigns a value to the type of airplane data member. set_current_speed(): Assigns a value to the current flying speed data member. set_max_speed(): Assigns a value to the maximum flying speed data member. get_type(): Returns the type of airplane. get_curent_speed(): Returns the current speed. get_max_speed(): Returns the maximum speed. Write a C + + program that creates two airplane objects, plane1 and plane2 and then invokes methods to fly the planes at a particular speed. Use cout statements to announce the speed of the airplane. Assign a maximum speed to your Airplane objects to prevent an airplane from flying faster than its maximum speed. You should have the header file (i.e. class definition) as airplane. h, the implementation file (that is the class methods definition) as airplane.cpp, and the driver airplanedrvr.cpp AS examples use 747 and 777 as types. For plane 1 set maximum speed to 1000, and for plane2 to 1500. For plane 1 set current speed to 700, and for plane2 to 1200. What happens if for example you set for plane 1 the current speed to 1200, and for plane2 to 1700. When you write the method you should take this into consideration
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
