Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new project in Code::Blocks and design and Implement a program that simulates the opening of a flood gate to allow excess water to

Create a new project in Code::Blocks and design and Implement a program that simulates the opening of a flood gate to allow excess water to be removed from a canal.
The canal has a natural flow rate of 40ft3s at 3.3 feet. Rainfall increases the water level of the canal and a flood gate must be opened to remove the excess water.
Prompt the user for the water level in feet (must be >3.3) and the number of feet to open the flood gate (must be 1), and simulate lowering the water level to 3.3 feet while displaying the minutes passed, and the current level of the canal to two (2) decimal places.
The program will simulate the discharge of water through the flood gate at a rate of 0.03 feet of water per minute for each foot that the food gate is open. This will continue until the water level in the canal has reached 3.3 feet.
Input must be validated with the specific error explained to the user as shown. The program will validate the input by only allowing a water level >3.3 and a gate opening 1, and loop to receive correct input, then start a loop to simulate draining the canal and display the minutes passed and current water level each time as shown on the next page in the sample output.
The program will end and announce when the canal has reached the natural level of 3.3 feet.
When the program ends, output your name and Lab #4.
FIVE MINUTES OF DESIGN TIME WILL SAVE HOURS OF PROGRAMMING...
Sample output:
Enter the water tevel in feet: 3.3
Water level must be greater than 3.3 feet.
Enter the mater level in feet: 4.3
Enter the gate epening in 1 foot increments:
Gate opening nust be preater than or equal to 1 foot. Enter the gate opening in 1 foot increments: 3
Enter the water level in feet: 4.6 Enter the gate opening in 1 foot increments: 2
Minutes Passed: 1 Water Level: 4.54 feet Minutes Passed: 2 Water Level: 4.48 feet Minutes Passed: 3 Water Level: 4.42 feet Minutes Passed: 4 Water Level: 4.36 feet Minutes Passed: 5 Water Level: 4.30 feet minutes Passed: 6 Water Level: 4.24 feet Minutes Passed: 7 Water Level: 4.18 feet hinutes Passed: 8 Water Level: 4.12 feet ninutes Passed: 9 Water Level: 4.06 feet hinutes Passed: 10 Water Level: 4.00 feet ninutes Passed: 11 Water Level: 3.94 feet ninutes Passed: 12 Mater Level: 3.88 feet minutes Passed: 13 Water Level: 3.82 feet winutes Passed: 14 Water Level: 3.76 feet winutes passed: 15 Water Level: 3.70 feet minutes Passed: 16 Water Level: 3.64 feet minutes Passed: 17 Water Level: 3.58 feet minutes Passed: 18 Water Level: 3.52 feet ninutes Passed: 19 hinutes Passed: 20 hinutes Passed: 21 ninutes Passed: 22 Mater Level: 3.46 feet Water Level: 3.48 feet Nater Level: 3.34 feet Water Level: 3.20 feet
The mater level is nom at 3.3 feet.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions

Question

A phasor voltage is given by V = j5 V. Find v(t).

Answered: 1 week ago