CMSC 104, Section 0102
Spring 2000
Homework 3
Homework 3 is due Wednesday, March 8 at the beginning of class. Late homeworks will NOT be accepted.
- First, solve each of the two problems shown below. You MUST show your work, no matter how simple you think the problems are. (5 points)
- Next, write an algorithm for each of the problems in pseudocode. Be consistent in style (e.g., use "Get" and "Display") when writing the pseudocode. Also remember to make the algorithms generic. (10 points each)
1) Ms. Smith kept two meatballs for herself, then divided the others equally
among her 14 children. If each child got five meatballs, how many did Ms.
Smith have to begin with? (Hint: There are three inputs to this algorithm. And one is NOT Ms. Smith's name!).
2) Mr. Jones went to a store, spent half of his money and then $20
more. He went to a second store, spent half the money he had left
and then $20 more. He then had no money left. How much money did
Mr. Jones have when he started out ? (Remember that Mr. Jones must have no money left at the end. Also, the "amount more" that Mr. Jones spends at each store will be the same at every store. Mr. Jones may also visit more than two stores.)