CSE 283 Introduction to Object Oriented Design

Barbara Nostrand, Ph.D.


CSE 283 Labs
Welcome to the site for CSE 283 Labs!

 

Lab 0 Projects

Prev | Next | Lab 0

 

Objectives

1. Practice using the text editor and Java compiler.
2. Gain experience with sequential programming.
3. Practice using the I/O facilities.

Introduction

Using the program Echo.java as a model,  solve one of the problems below (your instructor will tell you which one to do).

Unlike the laboratory exercise where we display a GUI list,  here you should run your program and display your output in the console window.  In order to do this,  you will need to include the standard Java console I/O package by replacing the include lines for java.awt.* and javax.swing.* with an include line for java.io.* and use the console output method println to print individual strings to the console.  The println method has an interface for each of the primitive data types in Java.  The println method prints objects by implicitly calling the toString method for the object. 

Method Summary
 void println(String x)
          Print a String and then terminate the line.

Projects

Note. The information displayed by any of the four projects should be "hard-coded" into the program and not passed as a parameter.

0.1. Write Flies.java -- a program that produces the following output:

                   like
            flies        an
      Time                   arrow ...

      Fruit        like      banana.
            flies        a

0.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

0.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.

0.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!"

Don't forget to clean up your directory when you are all finished...

Prev | Next | Lab 0

 
  Home

Schedule

Help

Lab 0

Lab 1

Lab 2

Lab 3

Lab 4

Lab 5

Lab 6

Lab 7-8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13






Last modified: 2007 OCT 28
bnostran@syr.edu