CIS-1130 ...

advertisement
CIS-1130
INTRODUCTION TO PROGRAMMING LOGIC
USING THE C++ LANGUAGE
2009
PROJECT # 5 (25 points)
**************************************************************************
*
*
* The fifth project will be due in on ???????.
*
*
*
*
Have your materials available in a folder on the due date
*
*
*
**************************************************************************
Program # 5 deals primarily with the concept of FUNCTIONS. We will modifiy program # 4 by dividing
the code into smaller segments or "modules" to accomplish basically the same task. Like program # 4, we
will use both the "IF" statement and the "SWITCH/CASE " statement as part of a our code to generate a
report which includes headers, detail lines and a summary report. As in program # 4, input data will be read
from a disk file. Output will directed to the printer. A sample of the output is included. Your output does
not have to look exactly like the sample but it should include all of the basic information.
As in Program # 4, after you have entered your source code, compile it to make certain there are no syntax
errors. If syntax errors occur, and remember they will, they need to be corrected before you resubmit your
program. Do this over and over again until you get a "clean compile". ("COMPILE SUCCESSFUL").
When your program is properly compiled, run your program to see whether your output is correct.
Remember, the input for the program is on disk and is the same input file (AUTODATA.TXT) we used in
program # 4!!).
After you have executed (run) your program, you need to hand in the following items in your folder:
(1) a listing of your source code
R
(2) the results of your program
R
(3) your data dictionary (Excel)
(4) a program flowchart or pseudocode (Word)
(5) a print spacing chart (Excel)
(6) Hand Calculations (Excel)
CIS-1130
Program # 5 - Pg. 2
PROGRAM SPECIFICATIONS
INPUT:
The INPUT RECORD layout for Program # 5 is listed below:
(Note: Refer to the handout for a complete explanation and layout
of the file entitled AUTODATA.TXT)
CAR MODEL
CYLINDERS
DOORS
COLOR
STICKER PRICE
MONTH
YEAR
AMOUNT CUSTOMER PAID
LENDER
SALESPERSON'S NUMBER
is a 12 character string
is an integer
is an integer
is an integer
is a floating point decimal
is an integer
is an integer
is a floating point decimal
is an integer
is an integer
Since the data is entered from a disk, you will need to include several #define preprocessor directives in
your program. They should be the same as they were in program # 4.
FORMULAS:
In addition to your input data, there are several "formulas" that you must include in your source code to
produce the "Summary Report". They all deal with the accumulation of "totals" to be used in the program.
DEALER COST
SINGLE CAR PROFIT
COMMISSION
TOTAL COMMISSION
=
=
=
=
STICKER PRICE X 74%
AMOUNT CUSTOMER PAID - DEALER COST
SINGLE CAR PROFIT * A GIVEN %
TOTAL COMMISSION + COMMISSION
CONSTRAINTS:
As in program # 4, after you open your input file, you will need to test to make certain that the data is on
drive A: (or your current drive) and that the name of the file is spelled correctly. If the file can not be found,
display a message that states "There is a problem locating the input file". More importantly "exit" the
program - do not go on since executing your program without data makes no sense!!
CIS-1130 ("C")
Program # 5 - Pg. 3
OUTPUT:
Listed below is a sample of what your output may look like after you execute (run) your program. Place
your output for program # 5 on the screen. Your results should be short enough to fit on one page.
PGCC FORD DEALERSHIP
COMMISSIONS PAID TO SALES PERSONNEL IN THE 2nd QUARTER OF 2008
REPORT PREPARED BY: PUT YOUR NAME HERE
SALESPERSONS
NUMBER
NNN
“
“
“
NNN
MONTH SOLD
BANK
COMMISSION
XXXXXXXXX
“
“
“
XXXXXXXXX
XXXXXXXXXXX
“
“
“
XXXXXXXXXXX
nnnn.nn
“
“
“
nnnn.nn
TOTAL COMMISSIONS PAID IN THE 2ND QUARTER
: nnnnnn.nn
OTHER PROGRAM CONSIDERATIONS:
Commissions will be determined based on the profit of each car sold. If the single car profit is under
$2000, then the commission for the salesperson is 6% of the profit. If the profit is between $2000 and $2500,
then the commission is 8% of the profit and finally if the profit is over $2500, the commission is 12% of the
profit.
Since Program # 5 deals primarily with Functions, I will give you a general outline of the main processing
portion of the program. You may change the names of the functions used, however, I expect you to make an
attempt to execute your functions in the order in which they appear in the handout.
Download