Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Please You are going to create a simulation to make air travel safe. Create an Airplane class that has the following attributes: model -
C++ Please
You are going to create a simulation to make air travel safe. Create an Airplane class that has the following attributes: model - like "Lear Jet", or "Boeing 747", or "MIG Figher" o altitude - the height in feet the plane is above sea-level o minAltitude - the lowest the plane flies o maxAltitude - the highest the plane flies and the following behaviors: o void display() which displays the model and the altitude void setAltitude which will set the altitude to a random number between minAltitude and maxAltitude bool crash(Airplane) which accepts an Airplane object as parameter and returns true if the planes crash. The definition of a crash is if the altitude of the 2 planes is 200 feet or closer. Then write a main program that creates 2 planes and runs a simulation in a loop to see how often they crash. Each loop iteration will call the setAltitude(for both planes. Run the loop 1000 times and at the end, tell the percentage of crashes. Note: you need to crash at least 5 times. Each time you crash, display each plane and its altitude. Only display the plane if they crash. You may have to adjust your loop iterations or min/max altitudes of the planes to make them crash at least 5 timesStep 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