CMSC 104, Summer 2004
Homework 2 - Basic Algorithms
Due Date:
Tuesday, June 15, 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) Ms. Block passed around a bowl of candy to the students
in her class. Before class, she ate 1 piece of candy and gave 3 pieces
to Mr. Frey. Eight students arrived for class. The first student took a
piece of candy, the second student took 3 pieces, the third student took 5
pieces and so on. After the last student took his/her candy, the basket
was empty. How many pices of candy were in the bowl at the beginning?
Tips about problem # 1 :
- The bowl will always be empty at the end.
- The user should specify the number of pieces Ms. Block
eats, as well as the number she gives to Mr Frey.
- The algorithm should work with any number of students,
so the user should specify the number of students.
- The user should specify the number of pieces that
that one student eats "more" than the previous student.
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 = 75/100 Exam 1 = 92/100
Homework 2 = 80/100 Project 2 = 90/100 Exam 2 = 80/100
Homework 3 = 100/100 Project 3 = 99/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.