Project #1 CMSC 131
Due Tuesday 2/14, 11:00 pm Object-Oriented Programming I
Type of project: Open Spring 2006

On The Money

 

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 which president appears on which denomination of U.S. currency (or vice versa).  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 three things:  Washington appears on the $1 bill, Lincoln appears on the $5 bill, and Jackson appears on the $20 bill.  That's it.

The program begins by prompting the user with:

    Enter 1 to guess a president, 2 to guess a denomination:

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

 

Processing an Entry of "1"

The program prompts the user with:

    Choose a denomination:

The user must enter either "1", "5", or "20".  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 three valid denominations, the program prompts the user with:

    Which president appears on the n dollar bill?

[In the prompt above, the "n" must actually be either "1", "5", or "20", depending on what the user has selected.]

The user will enter a String.  If the String entered represents the correct president for this denomination, 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 president:

The user must enter either "Washington", "Lincoln", or "Jackson".  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 three valid presidents, the program prompts the user with:

    Which denomination does President appear on?

[In the prompt above, "President" must actually be either "Washington", "Lincoln", or "Jackson", depending on what the user has selected.]

The user will enter a number.  If the value entered represents the correct denomination for this president, 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 OnTheMoney class with a main( ) method in a file named OnTheMoney.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 Homeworks section of the Eclipse tutorial. Follow the instructions given there to check out project Spring06Proj1. Then 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 "Spring06Proj1" files from your CVS repository, you will not be able to submit your work.

 

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: 

    Enter 1 to guess a president, 2 to guess a denomination: 1
    Choose a denomination: 5
    Which president appears on the 5 dollar bill? Lincoln
    Correct!
 

Example 2:

Enter 1 to guess a president, 2 to guess a denomination: 2
Choose a president: Jefferson
Invalid choice.

 

Example 3:

Enter 1 to guess a president, 2 to guess a denomination: 2
Choose a president: Washington
Which denomination does Washington appear on? 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.  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!

Web Accessibility