| Project #1 | CMSC 131 |
| Due Tuesday, 9/19 at 11:00PM | Object-Oriented Programming I |
| Type of project: Open | Fall 2006 |
Sports Quiz
Objective
This project will allow you to practice variables, strings, input/output facilities, conditional statements, logical operators, and the Eclipse IDE.
Overview
You will write a very simple application that asks the user to identify how many players are on a baseball, football, basketball, or curling team (or it may ask the user to identify which kind of team has 9, 11, 5, or 4 players.) It's not the most exciting project, but we have to start somewhere!
This project is considered "open". Please visit the course web page for information regarding the open/closed policy for projects of this course.
Specifications
Your program knows four things: There are 9 players on a baseball team; there are 11 players on a football team; there are 5 players on a basketball team; and there are 4 players on a curling team. That's it.
The program begins by prompting the user with:
Enter 1 to guess a sport, 2 to guess how many players:
The user then enters either "1" or "2".
Processing an Entry of "1"
The program prompts the user with:
Choose number of players:
The user must enter either "4", "5", "9", or "11". If any other number is entered, the program will print out "Invalid choice." and will terminate with no further output.
Assuming that the user has entered one of the four valid numbers, the program prompts the user with:
Which sport has n players?
[In the prompt above, the "n" must actually be either "4", "5", "9", or "11", depending on what the user has selected.]
The user will enter a String. If the String entered represents the correct sport for the number of players selected, the program will output "Correct!" and terminate. But if the user has entered the wrong String, then the program will output "Incorrect!" and terminate.
Processing an Entry of "2"
The program prompts the user with:
Choose a sport:
The user must enter either "baseball", "football", "basketball" or "curling". If any other String is entered, the program will print out "Invalid choice." and will terminate with no further output.
Assuming that the user has entered one of the four valid sports, the program prompts the user with:
How many players are on a SPORT team?
[In the prompt above, "SPORT" must actually be either "baseball", "football", "basketball", or "curling", depending on what the user has selected.]
The user will enter a number. If the value entered represents the correct number of players for the sport selected, the program will output "Correct!" and terminate. But if the user has entered the wrong value, then the program will output "Incorrect!" and terminate.
Getting Started
In order to help you get started, we have defined a SportsQuiz class with a main( ) method in a file named SportsQuiz.java. This file can be retrieved by checking out the project from the CVS repository. Remember that you must have set up your repository in order to check out and submit projects. Information on how to do this can be found in the Managing Projects section of the Eclipse tutorial. Follow the instructions given there to check out project Fall06Proj1. This screenshot shows the exact information that you will need to enter while creating your CVS repository connection. After checking out the project, when you switch back to the Java perspective, you will see the above files in the "Package Explorer" window, and you will be able to start modifying them.
If you write the project from scratch, without checking out the "Fall06Proj1" files from your CVS repository, you will not be able to submit your work.
Requirements
The following examples show how your program should behave. Note that items in italics represent the things that are entered by the user. Keep in mind these are just examples and not the only scenarios that your program is expected to handle.
Example 1:
Enter 1 to guess a sport, 2 to
guess how many players: 1
Choose number of players: 5
Which sport has 5 players? basketball
Correct!
Example 2:
Enter 1 to guess a sport, 2 to guess how many players: 2
Choose a sport: tennis
Invalid choice.
Example 3:
Enter 1 to guess a sport, 2 to guess how many players: 2
Choose a sport: baseball
How many players are on a baseball team? 5
Incorrect!
Submission
Submit your project from Eclipse by right-clicking the project folder and selecting "submit". You may submit as many times as you want -- we we only grade your most recent submission. After you have submitted your project, you should visit the submit server. There you can obtain limited feedback about how well your project is performing. (Choose "release test" to see detailed information.) The number of times you can run our tests on your project (before the due date) is limited. The earlier you begin working on the project, the more opportunities you will have to see how your project performs on our tests before the due date!
Grading
There are seven release tests which will be run on your project. Together, these tests will dictate 90% of the grade on the project. The remaining 10% will be based on your use of correct programming style.