Guest_imported
New member
- Jan 1, 1970
- 0
I am writing a program for my first programming class. The purpose of the assignment is to create a water estimater, which will calculate the volume of 4 rooms, then calc the amount of water needed to fill the rooms, then calc the cost to fill them. I got the program down just fine, but I am having troulbe getting my outputs into the correct decimal placement. instead of $1000.00 I just get 1000000 I appreciate any help that can be given, my code is written below.
Thanks again in advance for any help anyone can provide.
INPUT "Enter room name (DONE to quit) ", Nam
INPUT "Enter Length ", Length
INPUT "Enter Width ", RoomWidth
INPUT "Enter Height ", Height
INPUT "Enter Cost/Gallon ", GalCost
DO WHILE Nam <> EndNam
If Length <= 0 OR RoomWidth <= 0 OR Height <= 0 OR Galcost <= 0 THEN
PRINT "ERROR - Low Value!"
STOP
END IF
TotGal = Totgal + RoomGal
AvgVol = AvgVol + Vol
WaterCost = RoomGal * GalCost
TotWaterCost = TotWaterCost + WaterCost
Reccnt = RecCnt + 1
PRINT
PRINT
PRINT "Room Name", "Room Length", "Room WIdth", "Room Height"
PRINT Nam, Length, RoomWidth, Height
PRINT
PRINT "Room Volume ", Vol
PRINT "Cost Per Gallon "; USING "###.##"; GalCost
PRINT "Gallons "; USING "###.#"; RoomGal
PRINT "Water Cost "; USING "###.##"; WaterCost
PRINT
PRINT
INPUT "Enter Room Name", Nam
INPUT "Enter length", Length
INPUT "Enter Width", RoomWidth
INPUT "Enter Height", Height
INPUT "Enter Cost/Gallon", GalCost
LOOP
AvgVol = AvgVol / RecCnt
PRINT
PRINT
PRINT
PRINT "Total Gallons required "; TotGal
PRINT "Total Water Cost "; USING "####.##"; TotWaterCost
PRINT "Average room Volume "; USING "####.###"; AvgVol
END
Thanks again in advance for any help anyone can provide.
INPUT "Enter room name (DONE to quit) ", Nam
INPUT "Enter Length ", Length
INPUT "Enter Width ", RoomWidth
INPUT "Enter Height ", Height
INPUT "Enter Cost/Gallon ", GalCost
DO WHILE Nam <> EndNam
If Length <= 0 OR RoomWidth <= 0 OR Height <= 0 OR Galcost <= 0 THEN
PRINT "ERROR - Low Value!"
STOP
END IF
TotGal = Totgal + RoomGal
AvgVol = AvgVol + Vol
WaterCost = RoomGal * GalCost
TotWaterCost = TotWaterCost + WaterCost
Reccnt = RecCnt + 1
PRINT "Room Name", "Room Length", "Room WIdth", "Room Height"
PRINT Nam, Length, RoomWidth, Height
PRINT "Room Volume ", Vol
PRINT "Cost Per Gallon "; USING "###.##"; GalCost
PRINT "Gallons "; USING "###.#"; RoomGal
PRINT "Water Cost "; USING "###.##"; WaterCost
INPUT "Enter Room Name", Nam
INPUT "Enter length", Length
INPUT "Enter Width", RoomWidth
INPUT "Enter Height", Height
INPUT "Enter Cost/Gallon", GalCost
LOOP
AvgVol = AvgVol / RecCnt
PRINT "Total Gallons required "; TotGal
PRINT "Total Water Cost "; USING "####.##"; TotWaterCost
PRINT "Average room Volume "; USING "####.###"; AvgVol
END