CMSC 104, Spring 2006
Homework 2
Basic Algorithms
Out: Tuesday, February 21
Due: Tuesday, February 28, at the beginning of class
Note that late projects will NOT be accepted.
The Objectives
- To practice solving problems in a generic manner
- To practice writing basic pseudocode for the solution of a problem
The Assignment
- First solve each of the two problems shown below. (25 points each,
so make sure you show your work, no matter how simple you think it is)
- Then write an algorithm for each of these two problems in pseudocode.(25
points each)
1) Ms. Match went to a store, spent half of her money and then $ 10
more. She went to a second store, spent half the money she had left
and then $ 10 more. She then had no money left. How much money did
Ms. Match have when she started out ?
Tips about problem # 1 :
- You should solve this problem using the "working backwards"
technique we discussed in class. Hint: You probably want to
use a consider using a while loop.
- Ms. Match must always have no money left at the end.
- The user should specify the number of stores.
- The user should specify the "amount more" that Ms. Match spends
at each store, but it will be the same amount at every store.
2) Your grade in CMSC104 is based on the following:
3 Homeworks (4% each) = 12%
4 Projects (7% each) = 28%
3 Exams (20% each) = 60%
Total = 100%
If you have the following homework, project and exam grades at the end of
the semester, calculate your final grade for the course:
Homework 1 = 100/100 Project 1 = 100/100 Exam 1 = 70/100
Homework 2 = 75/100 Project 2 = 80/100 Exam 2 = 85/100
Homework 3 = 100/100 Project 3 = 90/100 Exam 3 = 80/100
Project 4 = 85/100
Tips about problem # 2 :
- You should allow the user to enter in each of
the homework, project and exam grades individually.