For this exercise you add several instance variables and methods for handling open and closed conditions to MusicStore.
-
Task 1
Add the instance variables openTime and closeTime to MusicStore. The data types should be int and the initial values should be reasonable times such as 9 and 21 (9 AM to 9 PM in 24-hour time), or something similar.
-
Task 2
Add four access methods for the integer-based open and closing time variables: setOpen(), getOpen(), setClose(), and getClose().
-
Task 3
Add a method that returns the appropriate boolean value for whether the
store is currently open or closed: isOpen(). The method should compare the instance variables openTime and closeTime with the current
system time. You will use the provided AltDate.getHourInt()
method to obtain the current hour (0..24).
-
Task 4
Add the convenience method getOpenClosedMessage(). It
should return a String value stating whether the store is
currently open or closed, based on the current system time and the
openTime and closeTime instance variables.
-
Task 5
For now, modify the method displayHoursOfOperation() so
that it reports the arbitrary (hard-coded) opening and closing times
you specified when initializing the openTime and
closeTime instance variables.
-
Task 6
Add functionality to TestMusicStore to display a message such as "We're Open!" or "We're Closed!".
-
Task 7
Compile the source code for MusicStore and TestMusicStore.
-
Task 8
Execute TestMusicStore.
Help for each of these tasks can be found on the next page.