CS 280 Spring 2008

Assignment 10 – More with Multiple Classes Working Together – including some method overloading and objects as parameters

100 points

 

Assigned: 03/27/2008

Due: 04/02/2008 at the start of class

 

Pre-Lab (Do Before Lab):  Bring materials – a USB for a take home copy.  Download, unzip and familiarize yourself with the partial classes etc that I’m providing – MusicalGenre enumerated type, ID class,  Song class, SongRating class, User class, and GUI driver class. Read the assignment and try to identify and understand your key tasks.

 

Main Assignment:

You are writing some parts of a simplified music rating program (potentially a simplified front end to an Internet radio station). We are still quite a ways away from being able to do the whole job, and I have provided a large amount of code, so please pay attention to what I’m asking for. Your job is to update the provided classes as indicated. Most of the methods you will write are in the Javadoc documentation for the classes.  The code is provided in a single zip file on Blackboard (they are multiple projects).  The zip also includes the javadoc generated html documentation for the classes.

The relationships among classes – A Song “has-a” MusicalGenre. A SongRating “has-a” Song. A User “has-a” Vector of SongRatings. The GUI “has-a” Vector of Users, a Vector or Songs, plus a current User and current Song and a currnet SongRating. I can draw a picture for you if it helps.

Status of things:

·         The ID class is complete.

·         The MusicalGenre enumerated type is sufficient

·         The Song class needs the following

o        Pseudo-inspector getLenTotalSecs which gives the total seconds in a song (e.g. a song that runs 3 minutes and 5 seconds should return 185). This method may not be currently used, but make sure your version works.

o        3 missing mutators – setYearRecorded, setLenMins, and setLenSecs. Each should update the appropriate instance variable if the passed value is ok (Year should be between 1900 and this year; minutes should be at least 0; seconds should be 0-59) Return true if input is valid, otherwise false.

·         The SongRating class needs the following:

o        increaseRating and decreaseRating should both be overloaded. The versions to be added are passed nothing (no parameter) and update the rating by one (increase increases by 1, decrease decreases by 1). Don’t let the rating go above or below the max and min (return false if the method is stopped from carrying out its mission).

·         The User class needs the following:

o        getAveRatings – which returns the average (mean) rating for all songs currently rated by the current user

o        isMatchingSongRatingFound – passed a Song, it checks the song rating info for the current user to determine if the passed song has been rated by the user

·         The GUI class needs the following:

o        Handling of the sort button (this should be VERY easy)

o        Handling of the Fix Song button. Make sure that the instance variables AND textfields are BOTH updated and that invalid values are not accepted (you should be going through the Song mutators written above)

There is processing involving files – my code should completely handle this. Sample files are in the proper folder in the zipped folders. The song list has all wrong years and lengths.

                See my simple sample interface below – it probably doesn’t need any adjustment to the GUI except adding you name on the form.  The paper version of this assignment shows a couple of screen shots from different points running my program. The version on my www site shows 9 screen shots from various points.

Make sure the Java version stays 1.5, NOT 1.6.

 

Hand in:

 

Miscellaneous:

·         Put  your name in the jlabel on the GUI form  

·         If the user enters letters into dialog boxes when fixing the song  – no worries – we won’t deal with this until we cover exceptions a little more.

o        MAKE SURE YOUR PROGRAM WORKS! (i.e. gets correct results, controls what is displayed/enabled).  It must provide all of the requested capabilities AND provide them in the expected way – don’t change my code to make your code work!  Check that the desired parameters and return types are provided.

o        Put YOUR NAME, date (IDE should put in for you), e-mail address and purpose of the program in comments at the beginning of the program. The purpose should be what the program should do, not the learning goals.

o        Indent to show any structure of the program (The IDE usually does this well if you don’t go back and change things)

o        You MUST include some comments that explain your program in order to get full credit,  including a javadoc compatible comment for each method (any place where I didn’t leave mine in)!!

 


On start up:

 

 

 


Having changed the user and song and rating:

 

 


Fixing Song:

 

 

 

Show User Ratings:

 

 

After Sorting: