Project #3 CSE_110 Project #3 – Meteor Defense System CSE_110 Project #3 – Meteor Defense System CSE 110 Introduction to Computer Science I Project #3 Final Project CSE 110 This program requires the...

I attached the assignment below! Thanks.


Project #3 CSE_110 Project #3 – Meteor Defense System CSE_110 Project #3 – Meteor Defense System CSE 110 Introduction to Computer Science I Project #3 Final Project CSE 110 This program requires the use of: · two (2) files: a main file (main.cpp) and a header file (*.h) · color text using the handle to the window, windows.h preprocessor directive, and SetConsoleTextAttributes function · system(“CLS”) to clear the screen using the windows.h preprocessor directive Project #3 – Meteor Defense System This Project requires the use of two (2) files - the main file (main.cpp) and a header file (*.h). Design and develop a program that simulates a Meteor Defense System (MDS) capable of radar tracking Earth-bound meteors, and launching missiles to intercept and destroy them before they impact Earth. The program will accept a meteor size in meters and distance from Earth in miles as user input, and output to the console window the Meteor Data, Engagement Status, and Meteor Status as shown below. The program will loop, clear the screen, and allow the user to enter another set of meteor data. 1. Prompt the user for a meteor size in meters and distance from Earth in miles 2. Validate the input (do not accept zero or negative values as input) – see below 3. Determine the meteor output information in accordance with the requirements a. Speed and Time to Impact b. Determine if the meteor can be tracked by the radar (limitations below) c. Determine if the meteor can be intercepted by a missile 4. Output the required information in the proper format and colored font 5. Ask the use if they want run it again. If yes, clear the screen and start over. All functionality and calculations must be in functions and in the separate header file. At a minimum, there shall be a get_input and show_output function. The Main function can only have variable declarations, the loop for another input with the prompt to continue or quit, and calls to the functions that are in the header file. Output Requirements and Format: Meteor Data: Diameter: Distance from Earth: Speed in mph: Time to Impact: Engagement Data: Missile Intercept Range: MDS Status: Meteor Status: Radar Limitations: The radar can detect and track meteors at a distance of: 708.11 km (440 miles or less) if they are at least 3 meters in diameter 531.08 km (330 miles or less) if they are at least 2 meters in diameter 354.06 km (220 miles or less) if they are at least 1 meter in diameter 177.03 km (110 miles or less) if they are < 1="" meter="" in="" diameter="" input="" validation:="" when="" invalid="" values="" are="" input,="" the="" program="" will="" output="" display="" in="" bright="" yellow="" “attention:="" invalid="" data="" has="" been="" entered”,="" and="" pause="" for="" ~2="" seconds,="" clear="" the="" screen,="" and="" re-prompt.="" meteor="" data:="" diameter="" in="" meters:="" is="" an="" input="" by="" the="" user="" distance="" from="" earth:="" is="" an="" input="" by="" the="" user="" speed="" in="" mph:="" will="" be="" computed="" by="" the="" program="" as="" 120="" mph="" *="" diameter="" in="" meters.="" time="" to="" impact:="" will="" be="" computed="" by="" the="" program="" using="" speed="" and="" the="" distance="" from="" the="" earth,="" and="" is="" displayed="" in="" minutes.="" engagement="" data:="" missile="" intercept="" range:="" will="" be="" computed="" by="" the="" program="" using="" the="" user="" input="" as="" follows.="" it="" takes="" 3.4="" minutes="" to="" launch="" a="" missile="" and="" intercept="" the="" meteor.="" during="" the="" 3.4="" minutes,="" the="" meteor="" is="" travelling="" toward="" earth.="" the="" missile="" intercept="" range="" is="" the="" distance="" from="" earth="" at="" which="" the="" missile="" will="" intercept="" the="" meteor="" given="" the="" speed="" that="" it="" is="" travelling="" and="" the="" 3.4="" minute="" interval.="" if="" this="" is="" a="" negative="" number,="" the="" output="" should="" be="" zero.="" mds="" (meteor="" defense="" system)="" status:="" this="" is="" computed="" by="" the="" program="" as="" follows:="" if="" “missile="" intercept="" range”="" is="" greater="" than="" 0="" miles,="" and="" less="" than="" the="" meteor’s="" distance="" from="" earth,="" then="" the="" status="" is="" “missile="" intercept="" probable”.="" otherwise,="" “missile="" intercept="" not="" possible="" -="" earth="" impact="" in="" x.xx="" minutes”="" earth="" impact="" is="" computed="" using="" the="" range="" and="" speed="" of="" the="" meteor.="" meteor="" status:="" if="" the="" meteor="" cannot="" be="" tracked="" by="" the="" system,="" then="" meteor="" status="" is="" “meteor="" cannot="" be="" tracked="" by="" the="" system,="" otherwise="" the="" status="" is="" “meteor="" inbound”.="" clearing="" the="" screen="" between="" runs="" of="" the="" program="" clearing="" the="" screen="" in="" c++="" -="" include="" the="" preprocessor="" directive:="" #include=""> Clear the screen: system(“CLS”); Pause the program: Sleep(1500); Test Data SPEED Time to Intercept System Meteor Size Distance MPH Trackable Impact Range Status Status 50 7 6 3 100 433 421 440 6000 Y 1.00 0 NOT Inbound 840 Y 30.93 385.4 Probable Inbound 720 Y 35.08 380.2 Probable Inbound 360 Y 73.33 419.6 Probable Inbound 3 441 360 NO 73.50 Cannot be tracked 2.73 2.5 321 330 327.6 Y 58.79 302.44 Probable Inbound 300 Y 66.00 313 Probable Inbound 2 350 240 NO 87.50 Cannot be tracked 1.67 221 200.4 NO 66.17 Cannot be tracked 1.67 219 200.4 Y 65.57 207.64 Probable Inbound 0.88 111 105.6 NO 63.07 Cannot be tracked 0.88 109 105.6 Y 61.93 103.02 Probable Inbound Part #1 - No Loop DATA Using color with the console window and Code::Blocks: · The preprocessor directive required is: #include · The handle declaration is: HANDLE hConsole; · This declares hConsole as a handle to the output window · To get the handle to the console window (output device). This assigns the current output device handle to hConsole hConsole = GetStdHandle(STD_OUTPUT_HANDLE); · The declaration and assignment can be done in a single line. HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); · In the program, when the condition is met: · Set the text attributes for the specific condition’s text · Reset the text attributes for the next line of text Setting and resetting the color (the HANDLE must be passed to the functions) · Change the text to green SetConsoleTextAttribute(hConsole, 10); // integers for color selection · Reset the text color attribute to white SetConsoleTextAttribute(hConsole, 15); Using multiple modules (files) in Code::Blocks: 1. Create the project in Code::Blocks. 2. Select New -> File. 3. Choose “C/C++ header and click “Go”. 4. The C/C++ header window will appear…select the browse button and locate the main project file. 5. The Select filename window will appear. 6. Name the file and allow the window to add the “.h” extension. 7. Click “Save”. 8. Back in the “C/C++ header” window, be sure that all of the check boxes are checked. 9. Then click “Finish. After you click finish, the file will open in your project and it will have the “#define” directive, and the directive test “#ifndef”. The #ifndef directive tests to see if the file has already been defined (included) somewhere else and if so it skips the code between #ifndef and #endif. This way the file is only defined (included) once in the program. Code will go here 10. Back in the main.cpp file, include the new header file with the other preprocessor directives, but use quotes instead of<> . header 11. Save the files. 12. The header file will contain the functions for the program. The program will have access to them because of the #include statement. 13. There is now no need to declare functions above main, and the definitions will go in the header file. 2 2
Dec 05, 2020
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here