Answered step by step
Verified Expert Solution
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 at 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 and the number of feet to open the flood gate must be and simulate lowering the water level to feet while displaying the minutes passed, and the current level of the canal to two decimal places.
The program will simulate the discharge of water through the flood gate at a rate of 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 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 and a gate opening 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 feet.
When the program ends, output your name and Lab #
FIVE MINUTES OF DESIGN TIME WILL SAVE HOURS OF PROGRAMMING...
Sample output:
Enter the water tevel in feet:
Water level must be greater than feet.
Enter the mater level in feet:
Enter the gate epening in foot increments:
Gate opening nust be preater than or equal to foot. Enter the gate opening in foot increments:
Enter the water level in feet: Enter the gate opening in foot increments:
Minutes Passed: Water Level: feet Minutes Passed: Water Level: feet Minutes Passed: Water Level: feet Minutes Passed: Water Level: feet Minutes Passed: Water Level: feet minutes Passed: Water Level: feet Minutes Passed: Water Level: feet hinutes Passed: Water Level: feet ninutes Passed: Water Level: feet hinutes Passed: Water Level: feet ninutes Passed: Water Level: feet ninutes Passed: Mater Level: feet minutes Passed: Water Level: feet winutes Passed: Water Level: feet winutes passed: Water Level: feet minutes Passed: Water Level: feet minutes Passed: Water Level: feet minutes Passed: Water Level: feet ninutes Passed: hinutes Passed: hinutes Passed: ninutes Passed: Mater Level: feet Water Level: feet Nater Level: feet Water Level: feet
The mater level is nom at feet.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started