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
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