CMSC 104, Summer 2002
Homework 2
Due Date:
The BEGINNING of class on Tuesday June 11
Note that late homeworks will NOT be accepted.
Objectives:
- To practice solving problems in both a specific and a generic manner
- To practice writing basic pseudocode for the solution of a problem
Assignment:
- First solve each of the two homework 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. Shoe kept 2 meatballs for herself, then divided the others equally
among her 14 children. If each child got 5 meatballs, how many did Ms.
Shoe have to begin with ?
Tips about problem # 1 :
- Your algorithm should allow Ms. Shoe to keep any number of
meatballs for herself. This amount should be specified by the
user.
- The user should also specify the number of children
- The user should also specify the number of meatballs
per child.
2) 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 # 2 :
- 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.