Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

CSE 110 Introduction to Computer Science I Project #2 - Flood Plain Simulation 2D 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 as it changes 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 and output the data as shown below including indicating 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 (add others as you see fit). 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 them. The functions must be in a separate header file. Using color in Code::Blocks include - reference slides on BB Declare the handle to the window and pass to the functions: 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); Extra credit (5 points): Display the surface area in acres covered by water at each interval of the simulation. Each unit is 0.5 acres. CSE 110 Introduction to Computer Science I Order of operations: Display the flood plain and a prompt to press enter: 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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago