Question: C++ Write a small program to simulate a helicopter flying; the class Flying has the methods API, enter_date, fly_helicopter: Method API calls the method enter_data

C++

Write a small program to simulate a helicopter flying; the class Flying has the methods API, enter_date, fly_helicopter:

Method API calls the method enter_data

Method enter_data asks the user how many helicopters are flying, to create an array of struct HelicopterData helicopter; helicopter containing the variables fuel and visibility; Method enter_data also asks for the fuel and what is the current visibility for each helicopter; then enter_data returns the array of helicopter to the method API;

Method API calls the method fly_helicopter, sending the array of helicopter to fly_helicopter;

Inside fly_helicopter, check for each helicopter: if the visibility is smaller than 60% don't fly and print the message "not safe to fly"; otherwise keep flying until the fuel is larger than 10%; every loop subtract 2% from the fuel and print the message, e.g.:"flying... now with fuel 30%" showing the value of the variable fuel; when fuel gets smaller than 10% print the message "low fuel 9% landing now" and finish the program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!