CMSC 104, Spring 2007
Homework 2
Basic Algorithms
Out: Thursday, February 22nd
Due: At the beginning of class on Thursday, February 29th
Note that late homeworks 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:
- Solve (find the specific solution) for 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 (general solution) for each of these two problems in pseudocode.(25 points each)
- 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.
- 1) Ms. Block passed around a bowl of candy to the students in her class. Before
class, she ate 1 piece 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 pieces of candy were in the bowl at the beginning?
Tips about problem # 1 :
- 2) Your grade in CMSC104 is based on the following:
3 Homeworks (3% each) = 9% 4 Projects (9% each) = 36% 3 Exams (15% each) = 45% 10 Quizzes (1% each) = 10% Total = 100%
If you have the following homework, project, exam and quiz 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 Quiz average = 90%Tips about problem # 2 :
- You should allow the user to enter in each of the homework, project and exam grades individually. The quiz grade should be entered as a average of all the quizzes.
Last Modified: Thursday, 15-Mar-2007 10:16:53 EDT