10.6k views
9 votes
Mary is a big fan of tropical fish. She has a few tanks of fish at home. To maintain a healthy environment for the fish, she needs to add conditioner to the water once a week. The amount of conditioner added is determined by the volume of the tank. According to the direction on the bottle, she has to add 1 ml of conditioner per 100 cubic inches of water. She wants a program to calculate exactly how much conditioner to add to a tank of water. All tanks are in rectangular shape. The program will ask for the length, the width and the height of the tank. It will calculate and display the amount of conditioner to be added. [Note: volume = length X width X height] Use the following two test cases for desk-checking [all in inches]:

length width height
20 22.5 10
16 10 15
Write a C++ programs that implements and then add code to write the result to an output file. Make sure you generate a description message with the data in the output file (i.e. The amount of conditioner to be added is 3 ml).
outFile << "The amount of conditioner to be added is "<< amount<<" ml"< Name output data file "conditioner.txt" .

1 Answer

8 votes

Answer:

Answered below

Step-by-step explanation:

# Program is written in Python programming language

conditioner_in_ml = 0

width = float(input("Enter width in inches: "))

height = float(input("Enter height in inches: "))

length = float (input("Enter length in inches: "))

#Calculate the volume

volume = width * length * height

#Calculate the amount of conditioner per 100 #cubic inches of volume

conditioner_in_ml = volume/ 100

print("The amount of conditioner required for $volume cubic inches is $conditioner_in_ml ml")

User Rachela Meadows
by
4.6k points