CSCI 201 Programming Project 1

Program Description

In this assignment, you will learn to read data from the keyboard and write it to the monitor. You will write a fortune telling program called Future. The program first asks the user to enter three pieces of information:

The program then prints the following output as the user's fortune:
Your fortune is:
  When you are age years old you will look 
  like a animal and live in city.
For example, if the user entered 13 for their favorite number, fish for their favorite animal, and Paris for the city where they would like to live, then the output would be:
 
Your fortune is:
  When you are 1300 years old you will look
  like a fish and live in Paris.

Notice that the value printed for age is not the number entered by the user, it is that number multiplied by 100.

You will need to use the Keyboard class to make the job of reading strings and numbers from the keyboard easy. To use the Keyboard class, follow these instructions when setting up your Netbeans project:

  1. Create a Netbeans project for this program; choose any name you like for the project.
  2. Create and mount the directory named csci/201/Fortune. The directory containing your program must have that name in order to receive full credit for this assignment.
  3. In the Netbeans explorer window, right-click on the csci/201/Fortune directory . In the pop-up window, select New followed by Folder, and then name the folder cs1.
  4. Save the Keyboard class in the newly created cs1 directory.
  5. Now create a new java main class file to contain the source code for your program. Store this file in your csci/201/Fortune directory giving it the name Fortune.java; the file must be named Fortune.java in order to receive full credit for this assignment.
  6. Now to use the Keyboard class in your program (i.e., Fortune.java) you simply need to include the following line of code at the start of your program:
      import cs1.Keyboard;
    
    Remember that capitalization is important. There are simple examples of programs that use the Keyboard class in chapter 2 of your text.

    Programming Style

    Note that 10% of your program grade is based on the readability of your program. This includes things like proper indentation, comments, and the naming of variables and methods as described in the style guide for this class. To receive full credit for your program, make sure that you use proper indentation as demonstrated in your text and in class room examples. Also include comments at the top of each program stating your name, the course, and the purpose of the program: For example:

    /*
    ** Name: your name here 
    ** 
    ** Course: CSCI 201 
    ** 
    ** Purpose: purpose of program here 
    */
    

    Submitting Programs

    The program written for this assignment must be turned in by placing it in your csci/201 directory. The program must have the name Fortune.java and it must be located in the directory csci/201/Fortune. The program will be automatically copied from this location on Feb 11th at mid-night.