Question: Please write a simple and very basic C + + program to answer this problem: Problem# 2 : Water Tank Filling Rates You have two

Please write a simple and very basic C++ program to answer this problem:
Problem#2: Water Tank Filling Rates
You have two water tanks, Tank A and Tank B. Initially, Tank A contains less water than Tank B. However,
the filling rate of Tank A is faster than the filling rate of Tank B . Write a C++ program that prompts the user
to enter the current water levels and filling rates for both tanks. The program calculates and outputs after
how many hours Tank A will have more or equal water than Tank B. It also prints the final water levels of
both tanks at that time.
Input/Output samples:
Initial water level of Tank A (liters): 200
Filling rate of Tank A (liters per hour): 40
Initial water level of Tank B (liters): 100
Filling rate of Tank B (liters per hour): 30
Error: The initial water level of Tank A must be less than that of Tank B.
Initial water level of Tank A (liters): 200
Filling rate of Tank A (liters per hour): 20
Initial water level of Tank B (liters): 300
Filling rate of Tank B (liters per hour): 20
Error: The filling rate of Tank A must be greater than that of Tank B.
Initial water level of Tank A (liters): 200
Filling rate of Tank A (liters per hour): 40
Initial water level of Tank B (liters): 300
Filling rate of Tank B (liters per hour): 20
After 5 hours, the water level of Tank A will be greater than or equal to the water
level of Tank B.
Water level of Tank A: 400 liters
Water level of Tank B: 400 liters
Please write a simple and very basic C + +

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!