Project #1 CMSC 131
Due:  Friday 9/21 at 11:00 pm Object-Oriented Programming I
Type of project: Open Fall 2007

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:

    Type 1 to enter a denomination, 2 to enter a president:

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 called Fall07Proj1 from the CVS repository. Remember that you must have set up your repository in order to check out and submit projects.  (Refer to Project #0 for more specific instructions.)   After checking out the project, switch over to Java perspective to open the source-code file and begin working on it.

If you write the project from scratch, without checking out the "Fall07Proj1" 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: 

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

Example 2:

Type 1 to enter a denomination, 2 to enter a president: 2
Choose a president: Jefferson
Invalid choice!

 

Example 3:

Type 1 to enter a denomination, 2 to enter a president: 2
Choose a president: Washington
Which denomination does Washington appear on? 5
Incorrect!

Example 4:

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

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.

 

Web Accessibility