CMSC 104, Fall 2004
Homework 2 - Basic Algorithms
Due Date:
Monday, October 4,at the beginning of class
Note that late projects will NOT be accepted.
Objectives:
- To practice solving problems in a generic manner
- To practice writing basic pseudocode for the solution of a problem
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) Mr. Jones decided to go gambling one night. He went to a casino
and spent $5.00 admission to enter. While gambling, he doubles his money.
He leaves and then pays $5.00 for parking. He goes to another casino,
pays $5.00 admission to enter and doubles his money. After he leaves
and pays $5.00 for parking, he has no money left. How much money
did Mr. Jones have when he started?
Tips about problem # 1 :
- Mr. Jones must always have no money left at the end.
- The user should specify the number of casinos.
- The user should specify the admission fee to enter the casino.
You can assume it will be the same for every casino.
- The user should specify the parking fee. You can assume
it will be the same each time he parks.
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 = 75/100 Project 1 = 70/100 Exam 1 = 85/100
Homework 2 = 90/100 Project 2 = 90/100 Exam 2 = 90/100
Homework 3 = 100/100 Project 3 = 98/100 Exam 3 = 81/100
Project 4 = 100/100
Tips about problem # 2 :
- You should allow the user to enter in each of
the homework, project and exam grades.