Project #8 (Terp Idol)
Due Date: Tuesday May 8, 6:00 pm
Object-Oriented Programming II
Type of Project: Closed
This project has several objectives. Those objectives are:
This project is considered a closed project. Make sure you read the open/closed policy before continuing working on this project.
Any clarifications or corrections associated with this project will be available at: clarifications.html
For this project you will complete the following tasks:
Javadoc documentation for this project can be found at CMSC 132 Terp Idol.
Your project will be graded as follows:
Public JUnit tests 45 %
Release JUnit tests 50 %
Style 5 %
For this project:
No secret testing is associated with this project.
Terp Idol Rules
The Terp Idol contest is run in a similar manner as American Idol.
Client-Server Programming Model
Your code must use a client-server programming model, where clients initiate contact with the server to request some service. The server waits for incoming client requests and sends back the appropriate response. Your task is to implement client and server classes that we can use to run online voting & information gathering for a Terp Idol contest. To do so you must implement code in the Contest, Server, CommandProcessor, Client, Voter, and Judge classes. The strings representing the messages between clients and the server are defined as static final in the Const class, and may be used in other classes using "import static terpIdol.Consts.*;". Setting up the contest will roughly require the following steps
Set up server
Set up clients
Handle client-server requests
The list of requests the contest server must process are shown in the following table:
|Sent by||Client Sends||Server Returns||Server Sends REQUEST FAILED if|
|Client||PING||SERVER RUNNING <date>|
|<unknown request code>||INVALID REQUEST <unknown code>|
|Voter||CONTESTANTS||CONTESTANTS <names on separate lines>|
|VOTE <name>||VOTE <name>||REQUEST FAILED <name> if no such contestant|
|LOOKUP <name>||LOOKUP <line in data file for name>||REQUEST FAILED if <name> not in file|
|IMAGES <url>||IMAGES <URLs of images on separate lines>||REQUEST FAILED if <url> not valid file/web page|
|Judge||INVITE <name>||INVITE <name>||REQUEST FAILED <name> if already contestant|
|TALLY||TALLY <names & # votes, each name on separate line>|
|NEW ROUND||NEW ROUND <name of eliminated contestant>||REQUEST FAILED if no contestants left|
To recognize images, the server will search through the html code of the specified web page, looking for entries starting with "<img src=" where any number of spaces and options (e.g. border) may exist in between img and src. An image is represented by the string following "src=", ending in a quotation mark. For instance, the following text are examples of possible image URLs for which you will be searching.
<img src="http://i.cnn.net/cnn/images/1.gif"> <img src="file:/C:/eclipse/workspace/p8/web/2.gif">
The server will return a list of URLs of images found. A URL is defined as one that starts with "http:" or "file:" and which provide the exact location of the image so that we can cut-and-paste the URL in a browser and actually see the image. For this project you don't have to worry about sites that may use uppercase letters for img or src in the html code.
Feel free to add any private instance variables and methods you understand are necessary. You may not add any additional public methods. Also, feel free to add any support classes you might need.
Java Construct Requirements
You must handle exceptions by defining the appropriate catch clause.
You may not use System.exit(0) in your code. If you understand that at some point you need to stop the program execution then throw an exception with an appropriate message as follows:
throw new IllegalArgumentException("Your message here");
Submit your project using the submit project option associated with Eclipse.
Please make sure you read the academic integrity section of the syllabus so you understand what is permissible in our programming projects. We want to remind you that we check your project against other students' projects and any case of academic dishonesty will be referred to the University's Office of Judicial Program