CSC 160 - Program #2
Assigned: Weds Jan 15, 2003 |
Pseudo-code due: Mon Jan 20, 2003 |
Program #2 is worth 50 points |
Program due: Weds Jan 22, 2003
|
Concepts
This program emphasizes the following "new" concepts:
- Working with arithmetic and relational operators
- Using the if() and switch() statements to conditionally execute statements
- Validating (checking) all user input
- Formatting output using <iomanip> functions
Description
This program comes straight from the book. Check it
out at:
Page 254
Programming Challenges #15 & #16
I have a couple extra requirements:
- Please use a switch statement (appropriately) somewhere in
your program
- Please use the cool <iomanip> functions to format your
output in a table, always include a dollar sign and two
decimal points with each dollar amount. Here's an example:
Customer |
Bill
Krieger |
Package |
B |
Hours used |
48.5 |
Base package cost |
$14.95 |
Extra hours cost |
$28.50 |
Total Cost |
$43.45 |
|
|
Note
to customer Bill Krieger: |
**>
You could have saved $23.50 this month using Package C. |
|
Grading
Your program will be graded on three areas: design, quality, and function.
Design (20%)
Your design must include detailed pseudo-code describing how your program
will function.
Quality (30%)
Your program must include:
- Header comment - You must have a comment block at the top
of each file with your name, the assignment, and a description of
what the code in this file does.
- Names - You must select informative names in your code.
Names include variable names, function names, class names, etc.
- Style - This is a broad topic. How your program looks will
impact how easy it is for others to understand. Visual C++ will help
you with indentation. Use the style given in our text for
capitalizing names or not. When still in doubt, ask me.
- Comments - You must comment important blocks of code. I
like commenting your pseudo-code right into your program. For now,
please comment the purpose of most variables. Comments should be
short and to the point.
Function (50%)
Your program must:
- Ask for the correct user input
- Validate the user input is correct. For example, if less
than zero hours are input, then you should output an error to the user
(e.g. "Error: Less than zero hours cannot be entered") and
exit your program. This is not the only check you need to make.
- Calculate correct totals... or, in other words, get the right
answers
- Format the output correctly.
Make sure you run your program with multiple test cases, including
cases with invalid input.
To hand your program in, please place two things in the
"prog02" folder on your k: drive:
- All the files (C++, obj, exe, etc.) associated with your program
- A README.txt file describing any problems you had with this
assignment and also the test cases you used to verify that your
program was working correctly.
Changes
Jan 20, 2003
I juggled the grade percentages slightly for design, quality and
function to (20%, 30%, 50%) from (25, 25, 50).