.cw 10
IUP Computer Science
CO 110 Fall 86
Wolfe, Cunningham, Maple
Programming Project #4 Due November 10
For this project you are to write a program that produces a report
regarding the operations of the Slow Poke Gas Station. Wally, the owner of
Slow Poke, has been keeping records on his temporary employees and wants to
determine who is doing the best job. Wally also wants to get some overall
statistics on gasoline sales to identify problems with his business.
Wally has kept an hourly log of all gasoline sales for the hours that
Slow Poke is open (8 am to 8 pm). He has three full days worth of data for
each employee. The form of the data is shown below.
1st record - Number of employees
2nd record - Name of first employee
3rd thru 14th records - Hourly log of sales for 1st day. Each log record
consists of the number of sales, and, for each sale, the number
of gallons and a 'U' for unleaded or an 'L' for leaded. Record
3 is for 8:00 to 8:59 am; record 4 is for 9:00 to 9:59 am; etc.
15th thru 26th records - Hourly log of sales for 2nd day (using the same
form as the log for the 1st day)
27th thru 38th records - Hourly log of sales for 3rd day.
39th record - Name of second employee
40th thru 75th records - Hourly sales for three days in the same order as
for the first employee.
. .
. .
This pattern is repeated for each subsequent employee. Following is a
partial sample of what the data might look like.
2
'BOB'
3 6.1 'U' 10.4 'L' 8.3 'U'
6 13.5 'U' 17.8 'L' 23.3 'L' 10.2 'U' 5.0 'U' 8.9 'U'
1 12.3 'U'
. .
. .
'ARNIE'
4 10.6 'U' 8.6 'L' 15.7 'L' 12.7 'U'
2 4.3 'U' 16.7 'U'
. .
. .
Here BOB is the first employee. He made three sales in the first hour (8:00
to 8:59) of his first day: 6.1 and 8.3 gallons of unleaded and 10.4 gallons
of leaded. He made 6 sales in the second hour, one in the third hour, etc.
ARNIE made 4 sales in his first hour, two in his second hour, etc.
From this data, your program must produce a histogram that shows the
total amounts of leaded and unleaded gasoline sold at the Slow Poke station
on an hour by hour basis. To obtain these amounts, the sales for all
employees on all days must be combined for each hour. The histogram should
display one * for each 10 gallons of unleaded sold (to the nearest 10 gal.)
and one # for each 10 gallons of leaded sold (to the nearest 10 gal.). For
example, if 212.7 gallons of unleaded and 137.3 gallons of leaded are sold,
21 *'s and 14 #'s should be displayed (see 8 am below). The following is an
example of how the histogram might look.
TOTAL GASOLINE SOLD (IN TENS OF GALLONS)
1 2 3 4 5 6
HOUR 0123456789012345678901234567890123456789012345678901234567890
8:00- 8:59 :*********************##############
9:00- 9:59 :********#####
10:00-10:59 :***************************************#######
. .
. .
19:00-19:59 :***************************####
The hour is specified using the 24-hour clock. Also, the scale for the
histogram is truncated so that the histogram fits onto this page.
In addition to the histogram, your program must print the names and
amount of sales for the employees who sold the most and least unleaded
gasoline and the names and amount of sales for the employees who sold the
most and least leaded gasoline. For example, if BOB has sold the most
unleaded gasoline, report this.
MOST UNLEADED SOLD BY BOB WITH 1245.3 GALLONS
Wally has determined that the cost of running the station is $5.37 per
hour that it is open. Wally's profit on gas is 11.2 cents per gallon of
unleaded and 12.8 cents per gallon of leaded. Your program must print a
message at the end, indicating whether Wally is making a profit or taking a
loss, how much it is, and what Wally's business rating is. Possible ratings
are GOOD (profit > $300), FAIR ($100 < profit < $300), POOR (profit < $100),
BAD (loss < $100) and PITIFUL (loss > $100). As examples,
WALLY'S PROFIT IS 204.84; HIS RATING IS FAIR or
WALLY'S LOSS IS 131.57; HIS RATING IS PITIFUL
There are no more than 10 employees. No employee makes more than 8
sales in one hour. No more than 990 gallons of combined leaded and unleaded
are sold during any one hour. Employee names contain no more than 10
characters. You must hand in a batched listing and run of your program. Do
NOT put the data in the JCL file; use only JOB, FORTRAN and RUN lines.
The histogram must begin at the top of a page of output. All output
must be done using formatted PRINT statements. The usual documentation
(identification, statement of program purpose and data table) is required.
A flowchart is required with this program. Use 8 1/2 by 11 paper and take
the same approach as on program 3.
The first executable statement in your program must be the following to
cause all READ* statements to get the data from the file, 110DATA4.COMPSCI.
OPEN (105, FILE = '110DATA4.COMPSCI')