| |
6. The MusicStore Class: Help | page 18 of 31 |
- Task 1
Design and implement MusicStore as a public class with one public method,
displayHoursOfOperation(). This method displays the daily hours of operation to the standard
output device (often called stdout or standard out), which is either a command window or an IDE window,
depending on your Java environment. Check the expected output to determine exactly what to print out.
For most environments, the source code should be in a file named MusicStore.java. Some environments, however, are not source file-oriented (for example, VisualAge for Java), in which case you simply type the code into the appropriate IDE window(s).
- Task 2
Design and implement TestMusicStore as a public class with one public static void method main(). main() performs the following tasks:
- Creates an instance of MusicStore
- Invokes the displayHoursOfOperation() method to display the daily hours of operation to standard output
- Terminates the program with exit()
For most environments, the source code should be in a file named TestMusicStore.java. Some environments, however, are not source file-oriented (for example, VisualAge for Java), in which case you simply type the code into the appropriate IDE window(s).
main() must have the signature:
public static void main(String[] args) {
// code here
}
- Task 3
Compile the source code for MusicStore and TestMusicStore.
Some Java environments require a CLASSPATH setting. You should set the CLASSPATH environment variable to include the current directory, but only if your environment requires CLASSPATH.
- Task 4
Execute TestMusicStore.
With the JDK, for example, simply invoke the Java interpreter with TestMusicStore as an argument:
D:\>java TestMusicStore
copyright 1996-2000 Magelang Institute dba jGuru
|