Docsity

Jukebox System Iteration 3: Developing the User Interface, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
C Sc 335 Programming Jukebox Iteration 3
Develop a User Interface (not eventdriven, but some a graphical view)
Real Due Date via electronic Turnin: Wednesday, 8th September, by 10:00 pm
Iteration 3 must have the following features
User must supply a valid existing ID to get access to the system ("one", "two", and "three" must work)
A user must be able to shut down the system with an ID of "zero"
If the ID is valid and the user has played 2 songs today, notify immediately and allow another user to log
into the system (Note: three will be code to set the number of songs played today to 0 in all Jukeboxes,
therefore you most likely have to change JukeboxAccount.
The user can select a CD from the collection of CDs by tray number.
There must be at least 3 "real" CDs to choose from where each has real tracks
The user can select a track from the collection of CdTracks in the selected CD
If a selection has been played 4 times, politely tell the user and allow the user to try another selection
Now that you have a well-tested model the data and business rules (canSelect, valid user accounts, CD
collections, account list write the classes necessary to have users interact with the Jukebox system. This
requires input and output of some sort. You are probably familiar with printlns for output and readlns
for input. In this project, input must be obtained with static methods of the JOptionPane class that generate
modal (can not continue until you deal with them) dialog boxes. For example, the following code takes the
string returned by showInputDialog and converts that string to an integer. The third method call
(showMessageDialog) displays another modal dialog box that must also be "okayed" before going on.
String prompt = "Enter an integer in the range of 1 through 10";
String inputAsString = JOptionPane.showInputDialog(null, prompt);
int anInt = Integer.parseInt(inputAsString);
JOptionPane.showMessageDialog(null, "You entered " + anInt);
Here is one sequence of dialog boxes that may represent the user interface for the Jukebox System:
These dialogs are shown to capture the essence of what we expect for the user interface (in industry, you
would have to visualize this with the users and the customer). You may format your input and output
differently as long as the interface allows any number of users to select a song from the CD collection in a
clear and robust (handles bad input well) manner. For example, if a user has already played 2 songs, the
system should to inform the user. If the selected song has already been played 4 times today, politely notify
pf3

Partial preview of the text

Download Jukebox System Iteration 3: Developing the User Interface and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

C Sc 335 Programming Jukebox Iteration 3

Develop a User Interface (not eventdriven, but some a graphical view) Real Due Date via electronic Turnin: Wednesday, 8th September, by 10:00 pm Iteration 3 must have the following features  User must supply a valid existing ID to get access to the system ("one", "two", and "three" must work)  A user must be able to shut down the system with an ID of "zero"  If the ID is valid and the user has played 2 songs today, notify immediately and allow another user to log into the system (Note: three will be code to set the number of songs played today to 0 in all Jukeboxes, therefore you most likely have to change JukeboxAccount.  The user can select a CD from the collection of CDs by tray number.  There must be at least 3 "real" CDs to choose from where each has real tracks  The user can select a track from the collection of CdTracks in the selected CD  If a selection has been played 4 times, politely tell the user and allow the user to try another selection Now that you have a well-tested model the data and business rules (canSelect, valid user accounts, CD collections, account list  write the classes necessary to have users interact with the Jukebox system. This requires input and output of some sort. You are probably familiar with printlns for output and readlns for input. In this project, input must be obtained with static methods of the JOptionPane class that generate modal (can not continue until you deal with them) dialog boxes. For example, the following code takes the string returned by showInputDialog and converts that string to an integer. The third method call (showMessageDialog) displays another modal dialog box that must also be "okayed" before going on. String prompt = "Enter an integer in the range of 1 through 10"; String inputAsString = JOptionPane.showInputDialog (null, prompt); int anInt = Integer.parseInt(inputAsString); JOptionPane.showMessageDialog (null, "You entered " + anInt); Here is one sequence of dialog boxes that may represent the user interface for the Jukebox System: These dialogs are shown to capture the essence of what we expect for the user interface (in industry, you would have to visualize this with the users and the customer). You may format your input and output differently as long as the interface allows any number of users to select a song from the CD collection in a clear and robust (handles bad input well) manner. For example, if a user has already played 2 songs, the system should to inform the user. If the selected song has already been played 4 times today, politely notify

the user and allow another song selection. If the user enters an out-of-range integer or an invalid integer, inform and ask the user to try again. Suggestions Who Generates these Dialog Boxes? Imagine the left-most input box (above) is generated by a loop that meant to read a JukeboxAccount ID. The rightmost message-box could be when a valid user with fewer than 2 songs played has selected a song. This simulates the playing of a song (we thought about playing real songs, but oooh those lawsuits). A SongSelector object could be responsible for showing the CDs and the songs from the selected CD. So the two middle dialogs could be generated by a SongSelector object that has access to the CD collection as an argument to determine what song the user wanted to play from the available selections. The SongSelector could then return a reference to the selected song back to the sender (most likely the JukeBox object). How do all these objects work together? Interactions between objects can be described with a UML style sequence diagram. We will develop such a diagram in a future lecture. Such an artifact will hopefully show how the objects work together. A Jukebox object could coordinate the sequence of events to make all of this happen. The Jukebox in this case would acts as a mediator between objects. The Jukebox makes connections between objects and coordinates the sequence of events that need to occur. To accomplish this in our system, the Jukebox class will likely contain references to many objects. Here is one possible set of instance variables for a mediator that send messages to different objects that allows a coordination of message sends: public class Jukebox { //--Instance Variables (YOURS MAY BE DIFFERENT) private JukeboxAccountCollection JukeboxAccounts; private JukeboxAccount currentAccount; private SongSelector songSelector; private CDCollection cdCollection; private CdPlayer theCdPlayer; private Song currentSelection; Unit tests for the User Interface? In this project, no unit tests are required for classes such as Jukebox, SongSelector, CdPlayer, or CardReader. Test the 3rd iteration by visually inspecting the interface. Turn in your project through Web-Based Turnin (from home) or by dragging and dropping your folder (in the lab) Follow the instructions at http://www.cs.arizona.edu/classes/cs227/fall04/turnin.htm Note: Subsequent submissions will overwrite the zip file in your folder without warning. This is the way to submit a newer version of an earlier turnin if you need to do that. The existing zip file will be replace by the newer version. You may do this many times.