CMSC 131 C.S. logo
Section 0101
Web Accessibility
Assignment:     Project #1
Due Date:     Thursday 06/13, 11:00PM
Open/Closed policy:     OPEN

Orioles Baseball

oriole bird

Click here to see the full roster for the Orioles!


Objective

This project will allow you to practice variables, strings, input/output facilities, conditional statements, logical operators, and the Eclipse IDE.


Overview

Professional baseball is interesting and exciting; this project... is not. But we have to start somewhere!

You will write a very simple application that asks the user to identify which Orioles players wear certain jersey numbers. (Or it might ask what jersey numbers do certain players wear.)

IMPORTANT: The program is limited to the four players in the table below. Your program will only be interested in the players' last names and corresponding jersey numbers.

  Cashner Mancini Villar Davis
Name: Andrew Cashner Trey Mancini Jonathan Villar Chris Davis
Jersey Number: 54 16 2 19
Position: Pitcher Outfielder Second Baseman First Baseman

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:   Cashner is number 54, Mancini is number 16, Villar is number 2, and Davis is number 19.  It does not know anything about any other players on the team, so please only bother to make it work for these 4 players.

The program begins by prompting the user with:

    Type 1 to enter a number or 2 to enter a name:

The user then enters either "1" or "2".

 

Processing an Entry of 1

The program prompts the user with:

     Enter player number:

The user must enter either 54, 16, 2, or 19.  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 player wears number n on his jersey?

[In the prompt above, the "n" must actually be either 54, 16, 2, or 19, depending on what the user had selected.]

The user will enter a String.  If the String entered represents the correct player name for the number 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.  [Note that the player names are last name only!]

 

Processing an Entry of 2

The program prompts the user with:

    Choose a name:

The user must enter either "Cashner", "Mancini", "Villar" or "Davis".  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 names, the program prompts the user with:

    What number does name wear?

[In the prompt above, "name" must actually be either "Cashner", "Mancini", "Villar", or "Davis", depending on what the user had selected.]

The user will enter a number.  If the value entered represents the correct number for the player 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 an OriolesBaseball class with a main( ) method in a file named OriolesBaseball.java. This file can be retrieved by downloading the project zip file here , and then importing the project into Eclipse (just as you did for Project #0). In case you've forgotten how to do the import, instructions can be found here in the Eclipse Tutorial.

If you write the project from scratch, without importing the zip file we have provided, you will not be able to submit your work easily.


Requirements

Sample Runs

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:

Type 1 to enter a number or 2 to enter a name: 1
Enter player number: 16
Which player wears number 16 on his jersey? Mancini
Correct!

Example 2:

Type 1 to enter a number or 2 to enter a name: 2
Choose a name: Emad
Invalid choice.

Example 3:

Type 1 to enter a number or 2 to enter a name: 2
Choose a name: Cashner
What number does Cashner wear? 99
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 determine 90% of the grade on the project.  The remaining 10% will be based on your use of correct programming style.