On This Page
Overview
The main points of this assignment are to:
- Develop algorithms for a set of problems
- Convert the algorithms into C++ code
- Use conditional expressions to add functionality to mathematical calculations
^ top
Specifications
Write a program that asks for the user’s height, weight and age, and then computes clothing sizes. Use the formulas provided below for the calculations.
- Compute the hat size using the formula: hat size = weight in pounds divided by height in inches and all that multiplied by 2.9.
- Estimate the jacket size, where the jacket size (chest in inches) = height times weight divided by 288 and then adjusted by adding 1/8 of an inch for each 10 years over age 30.
Note that the adjustment only takes place after a full 10 years. So, there is no adjustment for ages 30 – 39, but adds 1/8 of an inch starting at age 40. Then you add another 1/8 of an inch at age 50 and so on.
- Calculate the waist size, where the waist in inches = weight divided by 5.7 and then adjusted by adding 1/10 of an inch for each 2 years over age 28.
Note that the adjustment only takes place after a full 2 years. Thus, there is no adjustment for age 29, but adds 1/10 of an inch starting at age 30. Then you add another 1/10 of an inch at age 32 and so on.
Sample Operation
Give me your height in inches, weight in pounds, and age in years
and I will give you your hat size, jacket size (inches at chest)
and your waist size in inches.
Enter the height in inches: 73
Enter the weight in pounds: 175
Enter the age in years: 40
Hat size = 6.95
Jacket size = 44.48
Waist size = 31.30
Additional Specifications
- The name of the program source code file must be
sizer.cpp and all the code must be in this file.
- You must provide some instructions to the user like those shown though you may rewrite them in your own words.
- Input only the data shown in the Sample Operation and exactly in the order shown.
- You must report results exactly as shown except, of course, that the numbers output change depending on the input.
- Report numerical results using exactly two decimal places.
- You may assume that the user will enter only correct data types.
- Submit your file(s) to WebCT as explained in the section of this document: What to Turn In.
Hint: If you are using more than two or three if statements, you are probably using too many and need to use a different approach. You need to remember how to convert numbers to integers and what happens to the fractional part of an integer number.
^ top
Extra Credit
The following are worth extra credit points:
- Complete the assignment using pair programming. (1 point)
- Use a variable declaration with the modifier
const to give a name to all numbers except -1, 0, 1, and 2. See the instructions for No Magic Numbers. (1 point)
- Read ahead and use a while loop to allow the user to repeat this calculation as often as the user wishes as long as they enter a 'Y' or a 'y'. (1 point)
Enter Y or y to repeat (any other character ends): n
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
- All test cases pass
- 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
- Name, date, and program description in file comment block
- Follows specified format for file comment block
- Proper use of spaces around operators
- No tab characters are present in the source code
- As described in How To Document and Organize C++ Code
- 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 file submitted but some information was missing
- 0: No
README.txt file 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
sizer.cpp
You must submit all the files needed to make your assignment function properly. Do not assume that the instructors has any files unless explicitly stated by the instructor. Your assignment must work as submitted.
^ top
Home
| Blackboard
| Announcements
| Day Schedule
| Eve Schedule
Course info
| Help
| FAQ's
| HowTo's
| Links
Last Updated: March 05 2007 @13:25:52
|