CPSC-115 Fall 2008
Homework 1
Due: Beginning of class Thursday September 11, 2008
5 points
Professor Heidi Ellis
Goal: To write a flowchart that corresponds to an algorithm in outline form.
Problem:
You must write flowchart for the outline algorithm shown below. Hand in a hard copy of your flowchart at the beginning of class on Thursday 9/11.
Algorithm for computing fines on a library patron's overdue books:
- Initialize the patron's fine to be zero.
- Return a book.
- If the book is overdue:
- If the book is more than 30 days overdue:
- Then add to the fine a charge of $0.50 for each day the book is overdue.
- Else add to the fine a charge of $0.20 for each day the book is overdue.
- If there is another book to be returned, go to step 2.
- Print the patron's fine.
Helps:
- Make sure that you have a single entry (single begin) and a single exit (single end).
- Use the long or short form of tracing to ensure that your algorithm is complete and correct.