Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 110 Introduction to Computer Science I C++ Project #2 - Flood Plain Simulation arrays and interval modeling Problem: Design and develop a program that

CSE 110 Introduction to Computer Science I C++ Project #2 - Flood Plain Simulation arrays and interval modeling Problem: Design and develop a program that simulates the effect of rain on a flood plain. The display of the flood plain will change as a function of rainfall in inches per hour and time passage in hours. The initial terrain elevations above sea level are provided as a 2 dimensional array at the end of this document. Compare the terrain elevations with the rainfall accumulation over time to determine the output display. This will change during the simulation. The input from the user is rainfall in inches per hour, and the duration of rainfall in hours. The time interval for the simulation is in hours (1 hour per iteration). Step the program using cin.get(); which requires the user to press enter to step the simulation through an iteration. The display will show the changes to the terrain map as well as the elapsed time and accumulated rainfall in tenths of an inch. The program must clear the screen between displays. The display will indicate when rainfall has ended. The output for dry land is a green + plus sign, and the output for flooded land is a blue * asterisk. When the rain has stopped, the flood will recede at a rate of four (4) inches per hour, and the program ends when the flood plain is dry. The program must use functions called from main for getting input, and showing output. The loop for the simulation can be in main. The array and Handle to the console window must be declared inside main and passed to the functions that need it. Using color in Code::Blocks include Declare the handle to the window and pass to the output function: HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); In the output function, the values for color can be integers: SetConsoleTextAttribute(hConsole, 10); // sets text to green SetConsoleTextAttribute(hConsole, 9); // sets text to blue SetConsoleTextAttribute(hConsole, 15); // sets text to white Clearing the console window (clearing the screen) include : system(CLS); CSE 110 Introduction to Computer Science I Order of operations: Display the flood plain and a prompt to press enter: Initial Display Initial Display with 2.16 inches per hour entered CSE 110 Introduction to Computer Science I Next Screen with duration of 4 hours duration entered Simulation Running CSE 110 Introduction to Computer Science I Simulation Running (2 hours have elapsed) Simulation Running (3 hours have elapsed) CSE 110 Introduction to Computer Science I Simulation Running (4 hours have elapsed) Rain ended Simulation Running (5 hours have elapsed) water level receding CSE 110 Introduction to Computer Science I The Simulation continues and the flood recedes (The total rainfall accumulation is still shown) The Simulation continues until the flood has completely receded CSE 110 Introduction to Computer Science I The Simulation ends Flood Plain array the array is declared row then column (copy and paste): double floodPlain[18][18] ={ { 12, 13, 14, 15, 16, 16, 16, 17, 17, 18, 18, 19, 20, 20, 20, 19, 18, 18 }, { 12, 12, 13, 14, 15, 16, 14, 15, 15, 16, 18, 19, 20, 20, 20, 19, 17, 16 }, { 11, 11, 12, 13, 14, 15, 14, 13, 13, 14, 16, 19, 20, 20, 20, 19, 17, 16 }, { 10, 10, 11, 12, 13, 14, 12, 10, 11, 11, 11, 12, 18, 14, 12, 12, 15, 16 }, { 10, 10, 10, 11, 12, 11, 10, 8, 9, 8, 7, 11, 14, 12, 12, 12, 14, 15 }, { 9, 10, 10, 11, 11, 12, 8, 6, 6, 5, 5, 8, 12, 12, 11, 12, 14, 15 }, { 8, 10, 10, 10, 10, 8, 6, 5, 5, 5, 6, 10, 10, 10, 11, 13, 13, 15 }, { 7, 7, 7, 6, 5, 4, 4, 4, 5, 6, 7, 10, 10, 10, 10, 13, 14, 16 }, { 6, 6, 5, 5, 4, 3, 3, 4, 5, 6, 8, 10, 10, 10, 10, 11, 12, 12 }, { 6, 6, 5, 5, 4, 3, 4, 5, 6, 7, 10, 10, 11, 12, 12, 19, 14, 16 }, { 8, 6, 5, 6, 6, 4, 5, 5, 6, 8, 10, 10, 10, 10, 11, 19, 15, 17 }, { 10, 7, 6, 7, 7, 5, 6, 5, 7, 9, 10, 10, 10, 10, 12, 19, 16, 18 }, { 11, 8, 7, 8, 8, 6, 8, 9, 10, 12, 15, 16, 16, 17, 15, 16, 17, 18 }, { 12, 10, 8, 10, 10, 7, 9, 10, 12, 15, 16, 16, 17, 17, 16, 17, 18, 18 }, { 13, 12, 10, 10, 10, 8, 9, 10, 12, 15, 16, 16, 17, 17, 18, 19, 18, 18 }, { 13, 13, 12, 12, 12, 10, 10, 11, 13, 15, 16, 16, 17, 17, 18, 19, 18, 18 }, { 13, 13, 12, 12, 12, 10, 10, 11, 13, 15, 16, 16, 17, 17, 19, 19, 18, 18 }, { 14, 13, 13, 12, 12, 12, 12, 13, 14, 15, 16, 16, 17, 17, 20, 19, 18, 18 }};

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago