Answered step by step
Verified Expert Solution
Link Copied!

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 -

image text in transcribed

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 times

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago

Question

Knowledge of process documentation (process flow charting)

Answered: 1 week ago