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

jGuru: MusicStore: String Concatenation

 


by jGuru

[Help | API Docs | Short Course| Exercises]

For this exercise you (1) modify displayHoursOfOperation to use the current date and time values and (2) add a toString method to MusicStore.

Prerequisites

Skeleton Code

Tasks

  1. Modify the method displayHoursOfOperation so that it properly reports opening and closing times, that is, consistent with the times stored in the respective instance variables.

  2. Add a toString method to MusicStore that concatenates together pertinent information for the current instance and returns the resulting String.

  3. Modify TestMusicStore to test/display the functionality of MusicStore's toString method.

  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:

[owner = Carlos Valderrama, opens = 9, closes = 21]

Next Exercise

Exercises

Short Course

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