Hands on Testing Java: Lab #1

Homework Projects

Configure Your Project

  1. Create a file named Design/project01.txt.
  2. Create a new package in your project named edu.INSTITUTION.USERNAME.hotj.project01.
  3. Create the classes needed for the assigned project as part of the edu.INSTITUTION.USERNAME.hotj.project01 package.

The Projects

Your instructor will assign you one of the problems below. To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the lab exercise, first, design using OCD. Then code your design in Java using stepwise translation. Test your program thoroughly.

When executing your program to hand in as part of the project, a JUnit test case should test each method at least five times, but the test case itself needs to be executed just once. A driver program should be run at least five times with different inputs each time.

Project #1.1: Write Flies.java, a program that produces the following output:

                    like
            flies        an
      Time                   arrow ...

      Fruit        like      banana.
            flies        a

Project #1.2: Write Recipe.java, a program that produces the following output:

         Pop 1 cup of popcorn
        Melt 1 stick of butter
        Combine popcorn and butter
        Salt to taste

Or substitute your own favorite recipe.

Project #1.3: Write Direct.java, a program that produces detailed directions to your house, such as:

         Take I-96 to U.S. 131
        Take 131 3 miles south to Hall St.
        Take Hall 1 mile east to Madison Ave.
        Take Madison 3 blocks north to Sherman St.
        Take Sherman 2 blocks east to 1000 Sherman St.

Project #1.4: Write Me.java, a program that produces output describing yourself, such as:

   Name:    John Whorfin
   Gender:  Male
   Year:    Freshman
   Phone:   555-9876
   Hobbies: Swimming, volleyball and eighth-dimensional physics
   Quote:   "Laugh while you can, monkey-boy!"

The project does not read anything; it just spits out information about yourself.

Turn In

Turn the following things:

  1. This grade sheet
  2. A complete OCD for your program.
  3. Your source program.
  4. The output from an execution of your executable program.

Lab Home Page | Prelab Questions | Lab Exercise | Homework Projects