Question: c++ Programing You are going to create a simulation to make air travel safe. Create an Airplane class that has the following attributes: o model

c++ Programing

c++ Programing You are going to create a simulation to make air

You are going to create a simulation to make air travel safe. Create an Airplane class that has the following attributes: o 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 o 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 times

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!