All pastes #798676 Raw Edit

Dark3Lite

public text v1 · immutable
#798676 ·published 2007-11-26 23:00 UTC
rendered paste body
The manager of a hotel wants to calculate the cost of carpeting the room in the hotel. All the rooms are rectangular in shape. He has a file, rooms.txt, which contains data for the rooms. Each line of data consists of the room number, the length and breadth for the room in (meters), and the cost per square meter of the carpet for that room. For example, the data line:

325  3.0  4.5 40.00

means that room 325 is 3.0 meters by 4.5 meters, and the cost of the carpet for the room is $40.00 per square metre. The last line of the file contains 0 only, indicating the end of the data.

Write a program to do the following, sending output to the file rooms.txt.

print the suitable heading and under it, for each room, print the room number, the area of the room and the cost of the carpet for the room;
print the number of rooms processed;

print the total cost of carpeting all the rooms;

print the number of the room which will cost the most to carpet(ignore ties).