Assignment 2 – ArrayList UNSW Blogs Home UNSW Wikispaces UNSW Website MyUNSW RSS COMP1400 – Programming for Designers Class announcements for Programming for Designers Assignment 2 – ArrayList Posted by Claude on September 8th, 2014 · Assignments Your second assignment will test your ability to use lists. Your task will be to implement a class representing a playlist from a music program like iTunes. Due Date: Sunday week 8 (23:59:59 21 September 2014) Download the ass2.zip file to get you started. It contains three classes: Track – This class represents a single track with a name, a genre (from a list of constants on the class) and a duration (in seconds). Do not modify this file. PlayList – This is the class you are to complete. I have given you the headers for all the methods you need to implement. PlayListTest – This is a JUnit testing harness for your code. At the moment it provides only three tests. You should add more tests to this class to make sure your code works correctly. Note: You will only be marked on your modifications to the PlayList class. The PlayListTest class is there to provide you with some example tests to check your code is working. You should add your own tests to this class, but you will not be marked on them. Requirements A PlayList is a container for Tracks. It provides the following functionality: Two constructors: The first constructor simply asks for a name for the list and creates an empty playlist The second constructor asks for a name and a list of tracks. It creates a playlist and copies the tracks from the list (in order) onto the playlist. Accessor methods: getName – returns the name of the playlist getDuration – returns the total duration of all tracks on the playlist getNumberOfTracks – returns the number of tracks on the playlist getTrack – returns the specified track. Tracks should be numbered starting atone. filterByGenre – get the list of tracks from the playlist (in order) that match a given genre. Mutator methods: addTrack – add a track to the playlist Display methods: printListing – print out the name of the playlist and a numbered listing of all tracks on the playlist The formatting of the printListing method should look like the following: Queen's Greatest Hits 1: Bohemian Rhapsody - 5:54 2: Another One Bites The Dust - 3:34 3: Killer Queen - 3:01 4: Fat Bottomed Girls - 3:22 You can use the toString() method on the Track class to get the title and duration in a appropriately formatted string. Sample solution There is a sample solution (with source code removed) available to download. If any part of this specification is unclear, check the sample solution and reproduce its behaviour as closely as possible. Marking Marks will be awarded as follows: Constructors and accessor methods (except filterByGenre) – 25% addTrack – 15% filterByGenre – 15% printListing – 15% Style – 30% If the assignment is submitted late, 10% will be taken off the maximum mark per day, to a maximum of 5 days. Submission instructions You will submit your assignment to the Give automated marked system. From within your assignment 2 BlueJ project, select Project -> Create Jar File… In the Dialog Box that appears: Set “Main Class” to none Ensure “Include Source” is checked Leave “Include Bluej project files” unchecked Press “Continue” Save the filename as “Assignment2.jar” Open a web browser and go to the give web site Log-in with you Z-Pass Either enter “COMP1400″ in for the course, or select COMP1400 from the drop down menu and press “Search for Assignments”. Select “assignment2″ from the next drop down menu and press “Upload my Assignment” Accept the student declaration Press “Choose File” and select the “Assignment2.jar” file that you saved in step 4 Press “Submit my Files” Wait for the page to completely load. Then carefully read the output. If the assignment is successful you should see the following lines: ================================================
Checking your submission...
Checking for PlayList.java
PlayList.java Compiled Successfully
Checking for Track.java
Track.java Compiled Successfully
All files are OK
================================================ If the page doesn’t load properly, that is OK just submit the assignment file again. If you don’t get the above output check the output to see what went wrong and resubmit. Submission notes: You can submit as many times as you wish, even after the deadline. Only your last submission will be marked. Make sure you name everything the as instructed, including the classes and the submission file or the submission will not work. If you have any problems with submission, email the class account Email to friend Stay updated Tags: No Comments so far ↓ There are no comments yet...Kick things off by filling out the form below. You must log in to post a comment. Pages Course Outline for Semester 2, 2014 For Tutors Lab Times Lecture Notes and Example Files Software Weekly Quizzes Search Categories Announcements Assignments Lab Lectures Uncategorized Links BlueJ web site Submit/Collect Assignments View Marks Staff Claude Sammut (Lecturer) Timothy Wiley (Admin/Tutor) Troy Lenger (Tutor) Sam Ipsen (Tutor) Meta Log in Entries feed Comments feed WordPress.org UNSW Blogs User Tools Username and Password: Lost your password? COMP1400 – Programming for Designers Terms of Use Privacy Policy Copyright and Disclaimer Accessibility Acknowledgements UNSW Sydney NSW 2052 Australia Telephone +61 2 9385 1000 UNSW CRICOS Provider Code 00098G ABN 57 195 873 179 Design by jokay