Due Friday, July 17th, at the start of class.
Write a Perl script that maintains a simple movie review aggragator like Metacritic.
The user will run the script and be presented with a list of movie critics and their associated scores for a films. The order that the critics are listed in is not important. An average score for all of the reviews is also shown. The user can add and remove reviews. After each operation, the process repeats, with the list of reviews being shown, the average, and user input. The script will only allow a given reviewer to have a single score. If the user adds a score for an existing reviewer, the new score replaces the old score, and the user is warned that the program has done so. You may include a way to quit the program, but it is acceptable to require the user to use Ctrl+C or similar to terminate it.
When started, the program should know about the following three critics and associated scores. That is, they should be "hard coded" in. Despite being hard coded in, the user can delete or replace them.
Movie Critic | Rating |
---|---|
Manohla Dargis | 90 |
Roger Ebert | 88 |
Keith Phipps | 58 |
(Source: Reviews for Public Enemies from Metacritic)
The program should not attempt to save its state. When the program is re-run later, it will again have the hard coded reviews and nothing else.
A typical interaction might look like the following. The exact formatting is not required.
% ./homework-03-script Current reviews Keith Phipps: 58 Roger Ebert: 88 Manohla Dargis: 90 AVERAGE: 78.6666666666667 (a)dd review, (d)elete review a Reviewer name: Test Review score: 100 Current reviews Keith Phipps: 58 Test: 100 Roger Ebert: 88 Manohla Dargis: 90 AVERAGE: 84 (a)dd review, (d)elete review d Reviewer name: Keith Phipps Deleted Keith Phipps Current reviews Test: 100 Roger Ebert: 88 Manohla Dargis: 90 AVERAGE: 92.6666666666667 (a)dd review, (d)elete review a Reviewer name: Roger Ebert Review score: 50 Replacing old review score of 88 Current reviews Test: 100 Roger Ebert: 50 Manohla Dargis: 90 AVERAGE: 80 (a)dd review, (d)elete review
Tip: Like most programming languages Perl will preserve whitespace like tabs and spaces in strings. So "Roger Ebert" and "Roger Ebert " (note the trailing space) are different. An errant space or tab in your input could cause two critics that look identical to appear in your list. This is okay.
Do the work yourself, consulting reasonable reference materials as needed; any reference material that gives you a complete or nearly complete solution to this problem or a similar one is not OK to use. Asking the instructors for help is OK, asking other students for help is not.
A printout of your script on a single sheet of paper. At the top of the printout, please include “CS 368 Summer 2009”, your name, and “Homework 03, July 17, 2009”. Identifying your work is important, or you may not receive appropriate credit.