On This Page
Overview
During this assignment, you will:
- Write a program that counts the number of even and odd numbers a user enters
- Organize your program into functions
- Use pass-by-reference variables
^ top
Specifications
Write a program that that counts the number of even and odd numbers a user enters. The program counts the number of zeros entered as well. You must implement the following functions exactly as specified, though you may implement more.
void initialize(int& evenCount, int& oddCount, int& zeroCount): Initializes the counting variables.
void inputNumber(int& num): Gets a number from the user for classification.
void classifyNumber(int num, int& evenCount, int& oddCount, int& zeroCount): Classifies the number and increments the counts for even, odd and zero numbers.
void showResults(int evenCount, int oddCount, int zeroCount): Reports the results of the computations as shown in the Operation section.
Operation
Enter a positive number or -1 to exit: 5
Enter a positive number or -1 to exit: 4
Enter a positive number or -1 to exit: 3
Enter a positive number or -1 to exit: 2
Enter a positive number or -1 to exit: 1
Enter a positive number or -1 to exit: 0
Enter a positive number or -1 to exit: -1
You entered 3 even numbers, including 1 zeros, and 3 odd numbers.
Note that zero is an even number since it is evenly divisible by two.
Additional Specifications
- The name of the program source code file must be
classifier.cpp.
- Whenever the user enters a negative integer, the program exits.
^ top
Extra Credit
The following are worth extra credit points:
- Complete the assignment using pair programming. (1 point)
- Change the display of the word "zeros" such that the word "
zero" is displayed if one zero is entered and "zeros" is displayed if 0 or more than 2 zeros are entered. (1 point)
You entered 1 even number, including 0 zeros, and 1 odd number
Make certain that your README.txt file describes any extra credit attempted.
^ top
Grading Criteria
The instructor will evaluate your assignment using the following criteria. Each criteria represents a specific achievement of your assignment and has a scoring guide. The scoring guide explains the possible scores you can receive.
Some scoring guides have a list of indicators. These indicators are a sign of meeting, or a symptom of not meeting, the specific criterion. Note that a single indicator may not always be reliable or appropriate in a given context. However, as a group, they show the condition of meeting the criterion.
For information on grading policies, including interpretation of scores, see the course information page.
Program Compilation
- 4: Source code compiles with no errors or warnings
- 2: Source code compiles with warnings
- 0: Does not compile or wrong file turned in
Functionality
- 10: Demonstrates mastery of the assignment
- Has extra features or demonstrates techniques beyond the assignment
- Applies concepts from the lesson(s) appropriately
- Meets all specifications (see above) with particularly elegant solutions
- Runs to completion with no abnormal error conditions
- Generates correct output given correct input
- Behaves in a reasonable way in response to incorrect data
- Code is organized well into functions
- 8: Has all the functionality expected of the assignment
- Demonstrates many techniques from the lesson
- Meets all specifications (see above)
- Implementation seems more complicated than necessary.
- May have one minor error
- All test cases pass
- 6: Has most of the functionality expected of the assignment
- Demonstrates some techniques from the lesson
- Meets all but one of the specifications (see above)
- Implementation seems excessively complicated.
- May have 2-3 minor errors
- All but one test case passes
- 4: Has some of the functionality expected of the assignment
- Demonstrates some techniques from the lesson
- Meets at least 1/2 of the specifications (see above)
- Implementation seems excessively complicated.
- May have more than 3 minor errors
- At least 1/2 of all test cases pass
- 2: Serious functional problems but shows some effort and understanding
- Meets less than 1/2 of the of the specifications (see above)
- Has a major error or many minor errors
- Implementation seems very convoluted
- Demonstrates few techniques from the lesson
- Less than 1/2 of all test cases pass
- 0: Does not execute or no specifications met
Programming Style
- 4: Code is well-documented
- 3: Code has minor documentation errors
- Has 1 documentation error
- 2: Code has some documentation errors
- Has 2-3 documentation errors
- 1: Code has many documentation errors
- Has more than 3 documentation errors
- 0: No apparent attempt to document code
REAME.txt File
- 2: README.txt file submitted with specified information included
- 1: README.txt submitted but some information was not included
- 0: No README.txt submitted
Maximum Score: 20, plus extra credit
^ top
What to Turn In
Submit your assignment following the instructions for homework. Include the following items for grading:
README.txt file
classifier.cpp
You must submit all the files needed to make your assignment function properly. Your assignment must work as submitted.
^ top
Home
| WebCT
| Announcements
| Day Schedule
| Eve Schedule
Course info
| Help
| FAQ's
| HowTo's
| Links
Last Updated: October 23 2004 @20:36:27
|