Indiana University of Pennsylvania
Computer Science Department
CO 110   Main Session 84

  Programming Assignment #1


    Your first project is to write a program that will create a report on the sales force of a small company.  The data consists of the sales figures for January, February, and March for each salesperson and is given on a deck of cards where each person's figures are on are on a separate card.  The first card in the deck contains a number which indicates how many salespersons there are.  Each following card contains four numbers in the following order:  employee number, Jan. sales, Feb. sales, and Mar. sales.  The data to be used in your program follows.

    6
    115  10400.   6100.  11055.
    233  10045.   9900.   8420.
    239  10110.  10930.  13065.
    301  12500.   7990.  15884.
    312   7500.   9245.  12183.
    344  12015.  10042.  10644.

    For each salesperson, your program must calculate three values from the sales figures:  the total sales for that salesperson (sum of the three figures), the total pay for the salesperson (sum of pays for the three months), and the efficiency of the salesperson.  The pay of a salesperson is part salary and part commission.  Each employee gets a salary of $500 per month.  In addition, if the person's sales for a month are greater than $10000, the salesperson is paid 5% of the sales as a commission.  There is NO commission if the sales are less than $10000.  The efficiency of a salesperson is the total sales divided by the total pay.

    As your program reads in the information about each salesperson, it must print out a line which shows the employee number, the sales amounts for each of the three months, the total sales for the three months, and the total pay for the three months.  After processing the data for all employees, you program must print the total Jan. sales, total Feb. sales, total Mar. sales, total sales for all months and all employees, and the total pay for all employees.

    As the program reads the information about each salesperson, it must examine the total sales and the efficiency so that after processing all the employees it can print the numbers of the employees with the most sales and the greatest efficiency.  These two employee numbers should be printed with comments to describe them.  On the next page is the output for this program.

EMPLOYEE  JANUARY    FEBRUARY   MARCH      3 MO SALES  3 MO PAY
    115   10400.00   6100.000   11055.00   27555.00    2572.750
    233   10045.00   9900.000   8420.000   28365.00    2002.250
    239   10110.00   10930.00   13065.00   34105.00    3205.250
    301   12500.00   7990.000   15884.00   36374.00    2919.200
    312   7500.000   9245.000   12183.00   28928.00    2109.150
    344   12015.00   10042.00   10644.00   32701.00    3135.050

TOTAL     62570.00   54207.00   71251.00   188028.0    15943.65

THE MOST EFFICIENT SALESPERSON IS  233

THE PERSON WITH THE MOST SALES IS  301

    To help you get started with this project, a partial data table and two versions of the program (in flowchart form) are provided below.  You will have to add considerably to the data table.

    Data Table
    EMPNO          Employee number
    NUMBER         The number of salespersons
    JANSAL         January sales for a salesperson
    FEBSAL         February sales for a salesperson
    MARSAL         March sales for a salesperson
    COUNT          Loop control variable (number of salespersons
                        (whose data has been read)

    The Version I flowchart shows only the data reading and 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.  

    Except for echo printing, the Version II flowchart is an expansion of the Version I flowchart.  More of the computation is shown.  Still, it does not show the complete program.  You have to fill in the parts about initializing, calculating, and updating.

    REMINDERS

1.  Your program documentation (comments) must include the author, program number, section, due date, program description, and a complete data table.

2.  Don't forget to write your name, program number, and section 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.  You are not allowed to use DO loops, formatted READ and PRINT, or arrays in this program.

6.  GO TO statements should be used only to implement a loop.

7.  Indentation should be used to show statements within a loop and statements in the true and false tasks of a block IF.