{"id":747,"date":"2014-09-08T01:05:20","date_gmt":"2014-09-07T15:05:20","guid":{"rendered":"http:\/\/blogs.unsw.edu.au\/comp1400\/?p=747"},"modified":"2014-09-18T10:17:01","modified_gmt":"2014-09-18T00:17:01","slug":"assignment-2-arraylist","status":"publish","type":"post","link":"https:\/\/blogs.unsw.edu.au\/comp1400\/blog\/2014\/09\/assignment-2-arraylist\/","title":{"rendered":"Assignment 2 &#8211; ArrayList"},"content":{"rendered":"<p>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.<\/p>\n<h3>Due Date: Sunday week 8 (23:59:59 21 September 2014)<\/h3>\n<p>Download the\u00a0<a href=\"http:\/\/www.cse.unsw.edu.au\/~cs1400\/14s2\/assignments\/ass2.zip\">ass2.zip<\/a> file to get you started. It contains three classes:<\/p>\n<ul>\n<li><strong>Track<\/strong> \u2013 This class represents a single track with a name, a genre (from a list of constants on the class) and a duration (in seconds).\u00a0<strong>Do not modify this file.<\/strong><\/li>\n<li><strong>PlayList<\/strong> \u2013 This is the class you are to complete. I have given you the headers for all the methods you need to implement.<\/li>\n<li><strong>PlayListTest<\/strong> \u2013 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.<\/li>\n<\/ul>\n<p><strong>Note:<\/strong> You will only be marked on your modifications to the\u00a0<strong>PlayList<\/strong> 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.<\/p>\n<h3>Requirements<\/h3>\n<p>A PlayList is a container for Tracks. It provides the following functionality:<\/p>\n<ul>\n<li>Two constructors:\n<ol>\n<li>The first constructor simply asks for a name for the list and creates an empty playlist<\/li>\n<li>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.<\/li>\n<\/ol>\n<\/li>\n<li>Accessor methods:\n<ol>\n<li><strong>getName<\/strong> \u2013 returns the name of the playlist<\/li>\n<li><strong>getDuration<\/strong> \u2013 returns the total duration of all tracks on the playlist<\/li>\n<li><strong>getNumberOfTracks<\/strong> \u2013 returns the number of tracks on the playlist<\/li>\n<li><strong>getTrack<\/strong> \u2013 returns the specified track. Tracks should be numbered starting at<strong>one<\/strong>.<\/li>\n<li><strong>filterByGenre<\/strong> \u2013 get the list of tracks from the playlist (in order) that match a given genre.<\/li>\n<\/ol>\n<\/li>\n<li>Mutator methods:\n<ol>\n<li><strong>addTrack<\/strong> \u2013 add a track to the playlist<\/li>\n<\/ol>\n<\/li>\n<li>Display methods:\n<ol>\n<li><strong>printListing<\/strong> \u2013 print out the name of the playlist and a numbered listing of all tracks on the playlist<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>The formatting of the printListing method should look like the following:<\/p>\n<p><code><br \/>\nQueen's Greatest Hits<br \/>\n1: Bohemian Rhapsody - 5:54<br \/>\n2: Another One Bites The Dust - 3:34<br \/>\n3: Killer Queen - 3:01<br \/>\n4: Fat Bottomed Girls - 3:22<br \/>\n<\/code><\/p>\n<p>You can use the\u00a0<strong>toString()<\/strong> method on the Track class to get the title and duration in a appropriately formatted string.<\/p>\n<h3>Sample solution<\/h3>\n<p>There is a\u00a0<a href=\"http:\/\/www.cse.unsw.edu.au\/~cs1400\/14s2\/assignments\/ass2-sample.zip\">sample solution<\/a> (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.<\/p>\n<h3>Marking<\/h3>\n<p>Marks will be awarded as follows:<\/p>\n<ul>\n<li><strong>Constructors and accessor methods (except filterByGenre)<\/strong> \u2013 25%<\/li>\n<li><strong>addTrack<\/strong> \u2013 15%<\/li>\n<li><strong>filterByGenre<\/strong> \u2013 15%<\/li>\n<li><strong>printListing<\/strong> \u2013 15%<\/li>\n<li><strong>Style<\/strong> \u2013 30%<\/li>\n<\/ul>\n<p>If the assignment is submitted late, 10% will be taken off the maximum mark per day, to a maximum of 5 days.<\/p>\n<h3>Submission instructions<\/h3>\n<p>You will submit your assignment to the Give automated marked system.<\/p>\n<ol>\n<li>From within your assignment 2 BlueJ project, select Project -&gt; Create Jar File\u2026<\/li>\n<li>In the Dialog Box that appears:\n<ol type=\"a\">\n<li>Set \u201cMain Class\u201d to none<\/li>\n<li>Ensure \u201cInclude Source\u201d is checked<\/li>\n<li>Leave \u201cInclude Bluej project files\u201d unchecked<\/li>\n<\/ol>\n<\/li>\n<li>Press \u201cContinue\u201d<\/li>\n<li>Save the filename as \u201cAssignment2.jar\u201d<\/li>\n<li>Open a web browser and go to\u00a0<a href=\"https:\/\/cgi.cse.unsw.edu.au\/~give\/Student\/give.php\">the give web site<\/a><\/li>\n<li>Log-in with you Z-Pass<\/li>\n<li>Either enter \u201cCOMP1400\u2033 in for the course, or select COMP1400 from the drop down menu and press \u201cSearch for Assignments\u201d.<\/li>\n<li>Select \u201cassignment2\u2033 from the next drop down menu and press \u201cUpload my Assignment\u201d<\/li>\n<li>Accept the student declaration<\/li>\n<li>Press \u201cChoose File\u201d and select the \u201cAssignment2.jar\u201d file that you saved in step 4<\/li>\n<li>Press \u201cSubmit my Files\u201d<\/li>\n<li>Wait for the page to completely load. Then carefully read the output. If the assignment is successful you should see the following lines:\n<pre>================================================\r\nChecking your submission...\r\n\r\nChecking for PlayList.java\r\nPlayList.java Compiled Successfully\r\nChecking for Track.java\r\nTrack.java Compiled Successfully\r\n\r\nAll files are OK\r\n================================================<\/pre>\n<\/li>\n<li>If the page doesn\u2019t load properly, that is OK just submit the assignment file again.<\/li>\n<li>If you don\u2019t get the above output check the output to see what went wrong and resubmit.<\/li>\n<\/ol>\n<p>Submission notes:<\/p>\n<ol>\n<li>You can submit as many times as you wish, even after the deadline. Only your last submission will be marked.<\/li>\n<li>Make sure you name everything the as instructed, including the classes and the submission file or the submission will not work.<\/li>\n<li>If you have any problems with submission, email\u00a0<a href=\"mailto:cs1400@cse.unsw.edu.au\">the class account<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u00a0ass2.zip file to get you started. It contains three classes: Track \u2013 This class represents a single track [&hellip;]<\/p>\n","protected":false},"author":328,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[468],"tags":[],"class_list":["post-747","post","type-post","status-publish","format-standard","hentry","category-assignments"],"_links":{"self":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/users\/328"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/comments?post=747"}],"version-history":[{"count":5,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/747\/revisions"}],"predecessor-version":[{"id":750,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/747\/revisions\/750"}],"wp:attachment":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/media?parent=747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/categories?post=747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/tags?post=747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}