CPSC1103 ASSIGNMENT #4
You are the manager of a travel agency with 20 employees. You
have announced a promotional campaign for your agents to sell
vacation packages. Each day you will enter the ID number of the
agent (#1 - #20), the number of packages sold, and the dollar value
of the package. Entries will be in a random order and the total $
value is accumulated for a 3-week period. At the end of the
campaign you want a print out of those agents who sold less than
$2000.00 in the 3-week time frame. You will also want a list of
those that did not participate in the campaign (ones with no
sales).
Input and output are done using files and the eof
function.
SAMPLE INPUT:
1 3
2 0
15 1 3 4
12 2
13 4
2 5 1 2 7 5 1 5 3 4 21 3 -1 4
15 1
16 6
19 6 9 5 18 2 5 -2 15 6 13 2 17 3 25 5
250.00 0
1000.00 300.00 500.00 350.0 550.0 300.00 1250.0 150.0 115.00
400.00 250.00 200.00 350.0 1590.0 -150.00 140.00
115.5 530.0 550.00 1150.0 1350.0
(eg. Agent #1 sold 3 packages
at $250.00 for a dollar value
of $750.00)
SAMPLE OUTPUT:
KWANTLEN TRAVEL AGENCY LIST OF INVALID ENTRIES
-2-
21 3 -1 4 9 5 5 -2 25 5
400.00 250.00 -150.00
115.5 1350.0
** invalid agent # ** ** invalid agent # ** ** invalid price
**
** invalid packages ** ** invalid agent # **
TOTAL SALES BY AGENT
# SALES VALUE/SALE AMOUNT
1
2 2 550.00 3 8 207.50 4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
TOTAL SALES (NUMBER OF PACKAGES) FOR ALL AGENTS: AVERAGE SALES
VALUE FOR ALL PACKAGES FOR THE COMPANY: TOTAL VOLUME IN SALES FOR
THE COMPANY:
AGENT NUMBER
10 210.00 2100.00 1100.00 1660.00
7 1250.00
8750.00
1000.00 2500.00
4380.00 2100.00 3450.00 280.00 9540.00
2 500.00 6 416.67
8 547.50 6 350.00 3 1150.00 2 140.00 6 1590.00
-3-
TOP 5 WINNER OF THE SALES CAMPAIGN BY TOTAL DOLLARS IN
SALES
AGENT
DOLLAR VOLUME SOLD
19 $9540.00 7 $8750.00 15 $4380.00 17 $3450.00 13
$2500.00
AGENTS WHOSE SALES WERE BELOW $2000.00
AGENT
2 3 12 18
DOLLAR VOLUME SOLD
$1100.00 $1660.00 $1000.00 $ 280.00
AGENTS WHO DID NOT PARTICIPATE IN THE CAMPAIGN
4 5 6 8 9 10 11 14 20
HAND IN THE FOLLOWING:
a) a listing of your program and actual runs with the given
data. includes comments for each section
b) sample data
test all pathways in your program including all error
checks
c) sample report
show the results of all representative tests
d) PROGRAMMER DOCUMENTATION
methods used in coding your program
use structured flowchart or pseudo codes to explain logic
(algorithm). storage layout and variable list with meanings of
all variables.
e) user's guide
- a separate document which has the following:
-4-
- user purpose
- sample input & output
- show what it does
- state how to run the program
- describe any restrictions or limitations - show error checks
and error messages
You need four arrays:
int agentNo[21] = { 0, 1,2,3,4, 5, 6 ...}; int
numberPackages[21] = {0};
float totalSales[21] = {0.0};
float averageSales[21] = {0.0};
Read in :
1 3 250
int AgentNo , NoPackages ; float PricePackage;
ins >> AgentNo >> NoPackages >>
PricePackage; if all three data are good then
numberPackages[ ] += NoPackages; totalSales[ ] += NoPackages *
PricePackage;
AgentNo
AgentNo
-5-
Once when everything is read in you sort the four parallel
arrays by totalSales