On This Page
Overview
There are three parts to this assignment:
- Review Exercises:
First make sure you have completed and turned in the exercises from lesson 4. Then complete the Review Exercises in CodeLab 4. These exercises will help prepare you for the problem-solving program and should be completed first.
- Problem Solving Program:
Complete the programming projects following the Program Specifications listed below.
- Tutorial Exercises:
Complete the Tutorial Exercises listed below.
^ top
Program Specifications
General
- Note that you must complete these programs either by yourself or by working with one other student of this class following the rules of Pair Programming for Homework Assignments.
- Remember to follow all the style rules from the last assignments as well as the new rules we covered including:
- No magic numbers (See: No Magic Numbers)
- Indentation in
while statements and placement of curly braces (See: Indentation)
- Submit your files to Blackboard as explained in the section of this document: What to Turn In.
Working with Time
- Complete Exercise P3.11 on page 128 of the textbook.
- Add a
while statement that allows the user to repeat the program by entering a "y" (without the quotes).
- The name of the source code file for this program must be
comptime.cpp and all your code must be in this file.
Be careful of the spelling, including capitalization, as you will lose points for a misspelled name.
- Your program must operate like this:
Enter two times and I will print which comes first.
Enter the first time in military format (like, 1930): 1930
Enter the second time: 1700
1700 1930
Run again? (y/n) y
Enter the first time in military format (like, 1930): 0830
Enter the second time: 1930
830 1930
Run again? (y/n) y
Enter the first time in military format (like, 1930): 1930
Enter the second time: 1930
1930 == 1930
Run again? (y/n) n
Days in a Month
- Complete Exercise P3.23 on page 131 of the textbook.
- Add a
while statement that allows the user to repeat the program by entering a "y" (without the quotes).
- The name of the source code file for this program must be
monthdays.cpp and all your code must be in this file.
Be careful of the spelling, including capitalization, as you will lose points for a misspelled name.
- Your program must operate like this:
I will print the number of days in a month.
Enter the month (1-12): 9
30 days
Run again? (y/n) y
Enter the month (1-12): 2
28 or 29 days
Run again? (y/n) y
Enter the month (1-12): 1
31 days
Run again? (y/n) n
Hint: Thirty days hath September
Working with Numbers in the Electromagnetic Spectrum
- Complete Exercise P3.6 on page 127 of the textbook.
- Add a
while statement that allows the user to repeat the program by entering a "y" (without the quotes).
- The name of the source code file for this program must be
spectrum.cpp and all your code must be in this file.
Be careful of the spelling, including capitalization, as you will lose points for a misspelled name.
- Your program must operate like this:
Enter a wavelength and I will report the type of
the electromagnetic spectrum.
Enter a wavelength in meters: .001
Microwaves
Run again? (y/n) y
Enter a wavelength in meters: 4e-7
Visible light
Run again? (y/n) n
Hint: Here are the first few numbers in exponential and fixed notation. See lesson 4.1.2 for more information.
| Scientific |
Exponential |
Fixed |
| 10-1 |
1e-1 |
0.1 |
| 10-3 |
1e-3 |
0.001 |
| 7 x 10-7 |
7e-7 |
0.0000007 |
^ top
Extra Credit
The following are worth extra credit points:
- Complete the assignment using pair programming. (1 point)
- Complete Exercise P3.12 on page 128 of the textbook. The name of the source code file for this program must be
seasons.cpp. (2 points)
Your program must operate like this:
I will print the seasons.
Enter the month (1-12): 3
Enter the day (1-31): 20
The season is Winter
Run again? (y/n) y
Enter the month (1-12): 3
Enter the day (1-31): 21
The season is Spring
Run again? (y/n) n
Make certain that your README.txt file describes any extra credit attempted.
^ top
Tutorial Exercises
To prepare for the next lesson, complete the following exercises.
- Type the program
invtable.cpp from the textbook on page 149 into a text editor, and then compile and run the program. Submit your working source code file to Blackboard for grading using the file name invtable.cpp.
- Complete the Tutorial Exercises in CodeLab 4 before the specified due date. Refer to the assigned reading for the next lesson to help you understand the problems. Also, you can use the online lecture notes for more information as the notes become available. You can look at solutions if you miss your first attempt by clicking the "Solution" tab.
^ 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.
Lesson Exercises
- 2: All lesson exercises attempted and turned in
- 1: Some lesson exercises completed and turned in
- 0: No lesson exercises completed or turned in
Problem Solving Programs (x3)
- 5: Demonstrates mastery of the program
- Applies concepts from the lessons appropriately
- Meets all specifications (see above)
- Runs to completion with no abnormal error conditions
- Generates correct output given correct input
- Correct file name
- 4: Has most of the functionality expected of the program
- Demonstrates some techniques from the lesson
- Attempts to meet all but one of the specifications (see above)
- Implementation seems more complicated than necessary.
- May have one minor error
- 3: Has some of the functionality expected of the program
- Demonstrates some techniques from the lesson
- Attempts to meet at least 1/2 of the specifications (see above)
- Implementation seems excessively complicated.
- May have 2-3 minor errors
- 2: Serious functional problems but shows some effort and understanding
- Attempts to meet 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
- 1: Does not compile or wrong file turned in
- 0: Not turned in
Problem Solving Programs Style
- 3: Code is well-documented including:
- 2: Code has a minor documentation error
- 1: Code has some documentation errors
- 0: No apparent attempt to follow documentation standards or write documentation comments
CodeLab and Other Tutorial Exercises
- Number CodeLab completed correctly / number exercises * 8 and rounded up to the nearest integer.
- -1 if the tutorial exercise file does not compile
- -2 if the tutorial exercise file is not turned in
README.txt File
- 2:
README.txt file submitted following the instructions
- 1:
README.txt file submitted but some information was missing
- 0: No
README.txt file submitted
Total possible: 30, plus extra credit
^ top
What to Turn In
Submit your assignment to Blackboard, in the assignment folder that matches the name of this assignment, following the instructions for submitting homework. Include the following items for grading:
README.txt file
- All the exercise files from Lesson 4
comptime.cpp
monthdays.cpp
spectrum.cpp
- Optionally,
seasons.cpp (extra credit)
- The tutorial exercise source code files
You must submit all the files needed to complete your assignment. Your assignment must work as submitted.
^ top
Home
| Blackboard
| Day Schedule
| Eve Schedule
Syllabus
| Help
| FAQ's
| HowTo's
| Links
Last Updated: March 23 2010 @18:45:48
|