Sie sind auf Seite 1von 2

Thisisalivedocument.Pleasekeepcheckingitforupdates.

LibraryCardCatalog
Thisassignmentisdesignedtoreinforceyourunderstandingof
arrays
,
Regex
,loops,andJava,in
general.Itasksyoutobuilda
LibraryCardCatalog
classcapableofholdinganunknownnumber
ofcards.The
CardCatalog
hasafewsimplebehaviors,whicharedescribedbelow.Italsoasks
youtodevelopa
Menu
classwhichshouldcontainthe
main()
methodandprovidetheuserwitha
menuallowingtheusertoexerciseallofthefeaturesofthe
CardCatalog
class.

The
Card
Class
Each
Card
shouldhavethefollowinginformationaboutthebookitdescribes.
Theconstructorshouldtakeathreeparameters,the
title
ofthebook,the
author
ofthe
book,andthe
subject
ofthebook.
Usersshouldbeabletoaccessallthefieldsofthe
Card
.

The
CardCatalog
Class
Each
CardCatalog
shouldallowtheusertostoreCards.Theusercanadd,remove,andaccess
booksasdescribedbelow.
Bonus:ThearrayshouldGROWwhenthearrayisfull!
Theconstructorshouldinstantiatethreeseparatearrays,onetoholdthecardsinorderby
title
,onetoholdthecardsinorderby
author
,andonetoholdthecardsinorderby
subject
Thearraysshouldstartatasizeof10.
Usersshouldbeableto
addACard()
tothecatalogandthecardsshouldbefiledinthe
correctorderinsideofthearraysbasedonthecorrectfield.
Usersshouldbeableto
getATitle()
byspecifyingthebook's
title
(aString).Thismethod
shouldreturnthefirstCardwithatitlethatmatchesthegiven
title
.
Bonus:Thisshould
bedoneusingabinarysearch.
Usersshouldbeableto
getAnAuthor()
byspecifyingaspecific
author
.Themethodshould
returnallthebookswrittenbythisauthor.
Usersshouldbeableto
getSubject()
whichshouldreturnalistwhichcontainsallthe
booksthatinvolvethissubject.Thisshouldbeimplementedusingregextosearchforthe
books.
Usersshouldbeableto
removeATitle()
whichshouldremovethisbooksfromALLofthe
cardcatalogstacks.
Usersshouldbeableto
printTheCatalog()
whichshouldneatlyprintoutallofthebooksin
orderbyeithertitle,orauthor,orsubjectbasedonhowtheuserwantsit.

The
Menu
Class
Themenushouldprovidetheuserwiththeoptionofcreatinganew
CardCatalog
,andthenof
adding,removingindividualbooks,orofprintingalistofallbookswithinthe
CardCatalog
.

AssignmentcreatedbyProf.GregKesden,CarnegieMellonUniversity,editedbyPraveen
Garimella,CIHLintheyear2015.

Das könnte Ihnen auch gefallen