Chapter contents ] [ Course contents ] [ Write to us! webmaster@keller.com ] [ Home ] [ Curriculum ]

Chapter 8

Lab

Objectives:
Place StockAccount.java into the accounting package

You are provided with:

What you must do to complete the lab:

  1. Change into the chapter_8 directory.
  2. In the chapter_8 directory you will see a subdirectory called accounting.
  3. Make StockAccount a public class, and make its constructor public
  4. Move the StockAccount source to the accounting directory and compile:
    $ javac accounting/StockAccount.java
    	  
  5. The Accounting class is provided to test the classes in the accounting package. Compile Accounting and run it to check you get the results below:
    
    $ javac Accounting.java 
    $ java Accounting
    Thu Apr 30 20:55:24 PDT 1998    Buy Apple Computer      -451.95 Buy     20      -22.15  -8.95   AAPL
    Thu Apr 30 20:55:24 PDT 1998    Sell Apple Computer     274.55  Sale    10      28.35   -8.95   AAPL
    	  

Sample solution


Chapter contents ] [ Course contents ] [   ] [ Home ] [ Curriculum ]
http://www.keller.com/java/chapter_8/doc/lab.html
Updated Wednesday, 31-Oct-2001 14:19:26 CST

Copyright © 2001
Dan Keller Technical Services
4500 19th St., San Francisco
California, USA 94114
tel: 415 / 861-4500