Indiana University of Pennsylvania
Computer Science Department
CO 110 Spring 85
Programming Assignment #2
Your second programming assignment is to write a program
that produces a one-month expenses report for the sales force of
a small company. This program must be punched on cards and use
FORTRAN features discussed in class through the week of Feb. 4.
The data for this program is in three parts. The first part
is just one data card which contains a single number (the number
of salespersons for the company). The second part contains a
data card for each salesperson. Each of these cards contains an
employee badge number, a yearly salary, and an amount of sales
for the month. The third part of the data also contains a card
for each salesperson. Each of these cards contains an employee
badge number, the employee's travel expenses, the employee's
entertainment expenses, and the employee's telephone bill. All
the data is listed below.
5
115 14000. 10400.
230 15000. 13065.
239 12500. 8450.
301 16250. 9280.
344 12500. 11030.
115 175. 80. 114.
230 216. 134. 78.
239 181. 130. 91.
301 93. 188. 87.
344 160. 73. 131.
From the sales and salary figures, your program must
calculate each salesperson's commission and pay. The commission
depends on whether or not the salesperson has met the sales
quota. The quota is $10000 for each employee for each month. If
a salesperson does not sell at least $10000 worth of goods, that
salesperson's commission is 3% of his/her sales. If a
salesperson meets the quota (sells more than $10000 worth of
goods), that sapesperson's commission is 6% of his/her sales. A
salesperson's pay for the month is 1/12 of the yearly salary plus
the commission.
On the next page is the form of the report that your program
should produce (for the complete report, see the posted answers).
As the program reads in each salary/sales card, it must calculate
the commission and pay and print a line of the first part of the
report. As the reading of these data cards proceeds, the program
must keep track of which salesperson has the highest sales and
the total salary, sales, commissions, and pays for all
salespersons. After processing all salary/sales data, the
program must print out the totals for salary, sales, commission,
and pay.
As the program reads each expense card, it must calculate
the total expense (sum of travel, entertainment, and telephone
espenses) and print a line of the second part of the report. As
the reading of the expense data proceeds, the program must keep
track of the total expenses for all salespersons and of which
salesperson has the smallest expenses.
After printing the second part of the report, your program
must print the badge number of the salesperson with the highest
sales, the badge number of the salesperson with the lowest
expenses, and the total employee cost for the month. This last
value is the sum of the total pay and total expenses for all
salespersons.
PAYMENTS TO EMPLOYEES
BADGE SALARY SALES COMMISSION PAY
115 14000.00 10400.00 624.0000 1790.667
. . . . .
. . . . .
TOTALS xxxxx.xx xxxxx.xx xxxx.xxx xxxx.xxx
EMPLOYEE EXPENSES
BADGE TRAVEL ENTERTAINMENT TELEPHONE TOTAL
115 175.0000 80.00000 114.0000 369.0000
. . . . .
. . . . .
EMPLOYEE WITH HIGHEST SALES 230
EMPLOYEE WITH LOWEST EXPENSES 344
TOTAL EMPLOYEE COST FOR THE MONTH xxxxx.xx
Note: Each 'x' in the report represents a digit.
To help you get started on this project, a partial data
table and two versions of the program (in flowchart form) are
provided below and on the next page. For the complete program,
you will have to add considerably to the data table.
Data Table
NOEMP Number of salespersons
BADGE Employee badge number
SALARY Yearly salary
SALES One employee's sales for the month
TRAVEL One employee's travel expenses
PARTY One employee's entertainment expenses
PHONE One employee's telephone expenses
COUNT Loop control variable (number of salespersons
whose data has been read)
The Version I flowchart shows only the data reading and the
loop form. The echo printing will not be part of the final
program, but in Version I, the echo printing can be used to
verify that you are reading the data correctly. The Version II
flowchart is an expansion of the Version I flowchart, but without
the echo printing.
Version II shows more of the computation, but still not the
complete program. You must fill in the parts about initializing,
calculating, and updating.
REMINDERS
1. Your program documentation (comments) must include your name
as the author, the program number, your recitation section
number, the due date, a brief program description, and a complete
data table. (This is an extension from Program 1 documentation)
2. Don't forget to write your name, program number, and
recitation section number on the outside of the program before
handing it in.
3. Hand in only the printout, not the cards.
4. The printout need not be spaced exactly as the answers show;
however, your program must produce a similar looking report with
all the same values to get full credit.
5. Your are not allowed to use DO loops, formatted READ and
PRINT statements, arrays, or nonstandard FORTRAN in this program.
6. The second card of your deck must be !FORTRAN (LS,ANS)
7. GO TO statements should be used only to implement a loop.
8. Indentation should be used to show statements within a loop
and statements in the true and false tasks of a block IF.