当前位置 |首页 > CS代写 > JAVA代写 >
分享这个代写网站给同学或者朋友吧!

Curtin College

Object Oriented Program Design

Semester  2, 2018

Assignment

Due: 9am Monday 5th November 2018

Weight: 30% of the unit mark.


Introduction

Thisassignmentwilltakesignificanttimetoimplement.Youcannotfinishitinasingle nightorweekend!Youwillneedtoplanyourtimecarefullyandworkoneachbitasthe topic iscovered.

Your task is to create a music media library. The library will be able to perform the following:

  • Store details of music stored on Records, Cassettes, and Digitally;

  • Read the library details from an input file;

  • Add songs to the library based on user input;

  • Calculate the total play time of all songs stored in the library;

  • Findaspecificsong(basedonfirstoccurrencenamematches)andprinttheplay instructions for thatsong.

Allowtheusertoselectamediatypeandoption,andthenprintnumberofsongs and total run time for thattype:

  • – Records, and the record playspeed.

  • – Digital, and the filetype.

  • – Cassette, and the tapeside.

? Save the library to a file.

TaskDetails

The final functionality of the music library is as follows:

2.1 DataValidation:

The details of all music must conform to the following specifications.

? All songs have the following pieces of information:

Namemustnotbenulloranemptystring.

Artist – must not be null or an emptystring.

Durationmustbearealnumberbetween0.0and9.59(inclusive).Thismustbe a valid <min>.<sec> time. ie: 9.87 isinvalid.

? Records have the following additional information:

Track Number – Must be an integer between 0 and 20 (inclusive).

Play Speed – Must be one of the following strings, casing does not matter:

“33 1/3 RPM”

–  “45RPM”

–  “78RPM”

? Digital tracks have the following additional information:

Type – Must be one of the following strings, casing does not matter:

– “wav”

“mp3”

– “acc”

? Cassettes have the following additional information:

Track Number – Must be an integer between 0 and 20 (inclusive).

StartTimeMustbearealnumberbetween0.0and160.0(inclusive).Thismust be a valid <min>.<sec> time. ie: 5.89 isinvalid.

Side – Must be a character, A, or B, lowercase, or uppercase.

2.2 AddMusic:

Addsongstothelibrarybasedonuserinput,thesamevalidationastheprevioussection applies.

2.3 TotalDuration:

Calculate the total play time of all songs stored in the library;

2.4 PlayInstructions

Zero to Hero is track number 3 and the record is be played at 33 1/3 rpm.     MakeaManOutofYourequiresthewavcodectoplay.

Be Out Guest is track number 2, it starts at 2.30 minutes, on side A.

The user should be able to see the play instructions for each song. An example for each of the 3 music types is shows below.

2.5 Search:

Findaspecificsong(basedonfirstoccurrencenamematches)andprinttheplayinstruc- tionsforthatsong.Thisisasimplelinearsearch,loopthrougheacharray,andprintthe instructions for the first (only the first) match. Matches should ignorecase.

2.5.1Search &Duration:

Allowtheusertoselectamediatypeandoption,andthenprintthenumberofsongsand total run time for thattype:

? Records, and the record play speed.

? Digital, and the file type.

? Cassette, and the tape side.

2.6 Input &Output

Input and output should be done using the techniques from the lectures and practical sessions.

2.6.1 InputFile

Youwillberequiredtoloadthemusiclibraryfromacsvfile(thenameofwhichissupplied by the user). For each music type the csv file will conform to the followingformat:

Record R,<Name>,<Artist>,<Duration>,<Track Number>,<Play Speed>

Digital D,<Name>,<Artist>,<Duration>,<File Type>

Cassette C,<Name>,<Artist>,<Duration>,<Track Number>,<Start Time>,<Side>

R,Zero to Hero,The Muses,4.37,3,33 1/3 RPM D,Make a Man Out of You,Mulan and Chang,3.57,WAV C,Be  Our  Guest,The  Dishes,2.57,2,2.3,a

ThefirstletterofeachrowmustbeR,D,orC(inanycase),thisletterindicatesthetype of music the row is for. Below is an exampleinput:

Anymalformedrowsshouldbediscardedwhenreadingthefileandanappropriatemessage displayedtotheuserinformingthemofsuch,theremainderofthefileshouldcontinueto beread.Thefileitselfmayalsobeempty,youralgorithmshouldcheckforthisandprint an appropriate errormessage.

2.6.2 OutputFile

Your program must be able to save the current music library, to a file that conforms to the same format as the input file. That is, the generated output file must be able to be used on the next run of the program to “restore” the library to the same state. All real numbers should be formatted to 2 decimal places.

2.6.3 UserInput

All user input must be validated where appropriate.

2.7 UserOutput

All output to the user should be formatted in a pleasant, easy to read manner. This include prompts for input. All real numbers should be formatted to 2 decimal places.

2.8 ErrorHandling

Under no circumstance should the user be aware of exception handling, this includes having unhandled exceptions, and the user seeing any form of a stack trace.

All error messages displayed to the user should be meaningful to a non-programmer.

Documentation

You must thoroughly document your code using block comments (/*...*/) andin-line comments (//...). For each Class, you must place a comment at the top of the file containingyourname,thefilename,thepurposeoftheclassandanymodificationhistory. For eachmethod you write you mustplaceacommentimmediatelyaboveitexplaining its purpose, its import and export values, and how it works. Other comments must be included asnecessary.

SubmissionRequirements

Assignments should be submitted online via Moodle. Your submission should include:

The Design:

Pseudocode implementation of the algorithms.

TheCode:

.javafilesimplementingyourpsuedocodedesign(Donotsubmit.classfiles.)

.java files used to test your program

TheDocumentation

A PDF report, as outlined Below

4.1Report

Yoursubmissionmustincludeaoneandahalf(1.5)pagepagereport.Inthereportyou must discuss thefollowing:

? Justify your menu implementation decisions.

? Justify your approach to datavalidation.

?Justifyyourdesigndecisionsinregardstowhatfunctionalitywasplacedinthe container classes, and what functionality was placedelsewhere.

? Discuss any complications inheritance introduced in your design.

? Discuss and justify any down casting present in our code.

? Discussanychallengesyouhadinyourimplementation/design.

? Discussanychallengesyouhadinyourimplementation/design.

Youareresponsibleforensuringthatyoursubmissioniscorrectandnotcorrupted. You may make multiple submissions, but only your latest submission will be marked. You shoulddownloadyoursubmission,extractthecontentsandensureitstillcompiles/runs.

Please note that code should adhere to standard Java coding style and practices

Marking

ThepseudocodealgorithmandJavaimplementationwillbothbemarked.Yourjavacode willbeassessedbyitssuitabilityasavalidimplementationofyoursuppliedpseudocode. Thedemonstrationrequirementsforeachsubmissionaredescribedabove.Markswillbe allocatedfortheappropriatechoicesofclasses,theoverallfunctionality,andadheringto best programming practices as discussed in the lectures andpracticals.

Quizzes:

You cannotpasstheassignmentwithoutattendingyourweeklytutorialandattempting yourquizzes.Thisassignmentwillbeweightedbythetoptwoquizmarksasshownbelow.

YourtotalQuizmarkwillbeawardedasamarkoutof10,whichwillhavethefollowing effect (multiplier) on the assignmentmark.

Total Quiz Mark

Effect

7 - 10

100%

6

90%

5

80%

4

70%

3

50%

0 - 2

30%

AcademicMisconductPlagiarismandCollusion

Ifyouacceptorcopycode(orothermaterial)fromotherpeople,websites,etc.andsubmitit, youareguiltyofplagiarism,unlessyoucorrectlyciteyoursource(s).

Even if you extensively modify their code, it is still plagiarism.

Exchanging assignment solutions, or parts thereof, with other students is collusion.

Engaginginsuchactivitiesmayleadtofailingtheunit,orotherpenalties.Seriousorrepeated offencesmayresultinterminationorexpulsionaspertheCurtinCollegeAcademicIntegrity Policy.

Youareexpectedtounderstandthisatalltimes,acrossallyourstudies,withorwithout warnings likethis.

Refer to for additional guidance.


 

Design Brief

The following details some hints and tips you should follow in order to not be penalised in the assignment:

? Java file structure: you should have at a minimum the following classes:

MusicLibrary  Where the main method is located. Your main should only have the high-level last resort exception handling, and should call the menu from the UserInterface class.

UserInterface  This class should have all the user I/O. Including validation for said I/O. The UserInterface class should have no static methods ie: you must create an object of it.

FileManager – This class should have all the file I/O methods. MusicCollection – This manages manages the functionality. The controller class should have no static methods ie: you must create an object of it.

To have the search method take a String, you will need to treat the cassette side search criteria as a string.

? The storage facility (MusicCollection) should only be constructed once. It must ini- tially be constructed based on file input ie: you cannot perform any operations on the library until it is constructed. Subsequent attempts to construct the library should fail and an appropriate error message output to the user ie: you cannot read another file.

? You should have a single array of the superclass(Music). The max number of objects stored in this array should be 30, the objects may be of any type in any order.

? You should only need to refer to the exact subclass when initially constructing an object.

? You will need to make good use of abstract methods (in the diagram below, an abstract method is represented with italic text)

 

The basic UML for the container classes is shown below. You will require all the accessors and mutators as emphasised in the lectures and practicals (these are omitted below for simplicity). The methods in MusicCollection have also been left for you to decide.

image.png

 

End of Assignment


代写