Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a class named Helicopter that has the following member variables: year - An variable that holds the aircraft's model year. make - A string
Write a class named Helicopter that has the following member variables:
year An variable that holds the aircraft's model year.
make A string object that holds the make of the aircraft
owner A string object that holds the type of owner of the aircraft.
speed An int data type that holds the aircraft's current speed.
altitude An int data type that holds the aircraft's current altitude.
latitude location An int data type that holds the aircraft's current latitude position.
longitude location An int data type that holds the aircraft's current longitude position.
In addition, the class should have the following member functions.
Constructor The constructor should accept the aircraft's owner and make arguments and assign these values to the objects owner and make member variables. The constructor should initialize the speed variable to and the altitude variable to
Accessors Appropriate accessor functions should be created to allow values to be retrieved from an objects year, make, owner, altitude, and speed member variables.
Mutator Appropriate mutator function should be created to allow the value to be set of the objects year, make, owner, altitude, and speed member variables.
accelerate The accelerate function should add to the speed member variable each time it is called
decelerate The decelerate function should subtract from the speed member variable each time it is called
ascend The ascend function should add to the altitude member variable each time it is called
descend the descend function should subtract from the altitude member variable each time it is called
toString The toString function should return the entire state of the aircraft class using labels to identify the data values of the data members of the object
Demonstrate the class in a program that creates a Helicopter object and then calls the accelerate function five times. After each call to the accelerate function, get the current speed of the aircraft and display it Then, call the brake function five times. After each call to the brake function, get the current speed of the car and display it
After testing the accelerate and brake functions, call the function to change the engine type and pass it a value for a different engine. display the state of the Aircraft using the toString function
Students may use any development environment of their choice. However, I will not be able to support the variety of possible development environments on my side. Many of the alternate Integrated Development Environments IDEs may require additional folders and files to execute the project. My only requirement for the C programs submitted for this course will be that the code is combined into a single C source file that can be compiled and executed with a standard C compiler.
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