Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

jGuru: MusicStore with an Owner

 


by jGuru

[Help | API Docs | Short Course| Exercises]

For this exercise you add an owner instance variable and the method setOwner to MusicStore.

Prerequisites

Skeleton Code

Tasks

  1. Add the instance variable owner to MusicStore. The data type should be String and the initial value should be "No owner.", or something similar.

  2. Add the method setOwner to MusicStore. This method should set the instance variable owner to whatever String value is passed as an argument.

  3. Add functionality to TestMusicStore to set the store owner's name.

  4. Compile the source code for MusicStore and TestMusicStore.

  5. Execute TestMusicStore.

Where help exists, the task numbers above are linked to the step-by-step help page.

Solution Source

Demonstration

The output should be similar to the following, either on the command line or in an IDE window:

Store Hours:
Daily:  9:00 AM - 21:00 PM
Roberto Baggio, Proprietor

Next Exercise

Exercises

Short Course

Copyright 1996-2000 jGuru.com. All Rights Reserved.