Question: C++ Create a class helicopter containing the public method API; API calls the private methods: weather_input, fill_tank, fly_helicopter, shoot_rockets The local pointer variable *myHelicopter defined
C++
Create a class helicopter containing the public method API; API calls the private methods: weather_input, fill_tank, fly_helicopter, shoot_rockets
The local pointer variable *myHelicopter defined as "struct flying_data" declared in the method APO; myHelicopter requires struct dynamic allocation to match what user informs about how many helicopters are flying: 2 or 3; This struct contains: pilot_name, rockets, visibility, fuel; declare rockets as a type of variable "vector" or integer containing 4 rockets, 1 is loaded or 0 is empty/discharged
Method weather_input: ask the user what is the current visibility if below 60% abort for safety reasons;
Method fill_tank: also ask how many bars of fuel the helicopter has: 10 bars meaning 100%, 5 bars is 50% and so on; if fuel has only 10% of fuel it is not safe to fly;
Use pointers to pass myHelicopter among the functions that are called from API. From fly_helicopter: print on every loop iteration the fuel level; every loop decreases 3% from current tank level;
Method shoot_rockets: provide two versions of this same method showing overloading usage {normal rocket; nuclear rocket (tactical nuclear weapon)}; ask user which type of rockets are in use; start shooting rockets only when fuel reaches half of the initial tank level, shooting one rocket in every 3 loops.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
