Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Java Programming question:

Develop an online store which sells dvds and books execpt this time,

we will also be selling AudioBooks which are specialized versions of Books (i.e., extension will come into play here). Use of multiple classes is a must for this Assignment and the perspective will be that of a store owner maintaining a Catalog.

The updated requirements for entities are as follows:

  • Each CatalogItem has a title of type String.
  • Each CatalogItem has a price of type double.
  • Each Book (is a CatalogItem) has an author which is of type String.
  • Each Book has an ISBN number which is of type int. Every book has a unique ISBN number.
  • Each AudioBook has all of the properties of a Book, and in addition has a property named

runningTime of type double (conceptually you can think of this as minutes, but it doesn't matter

for the purposes of the assignment).

  • Each DVD (is a CatalogItem) has director which is of type String.
  • Each DVD has a year which is of type int.
  • Each DVD has an dvdcode which is of type int and is unique for all DVDs.

Each of the properties is mandatory (cannot be a default) and private, and only retrieved via public getter methods (for example: getPrice which would return the price of a Book or DVD), and the properties can only be set via constructor functions.

Additionally, AudioBooks are special - when the price is retrieved via the method getPrice, the method in

the parent (Book) class is overridden, and instead the price is retrieved as the regular price of the book with a 10% discount (i.e., 90% of the price).

Each of the classes must define a toString method which *returns* information about the entity as follows:

For Books it would be:

Title: | Author: <author> | Price: <price> | ISBN: <isbn></p> <p style="text-align: justify;">For AudioBooks it would be the same for books, except the price would be the discounted price and we</p> <p style="text-align: justify;">would append: | RunningTime: <runningtime>.</p> <p style="text-align: justify;">For DVDs it would be:</p> <p style="text-align: justify;">Title: <title> | Director: <director> | Price: <price> | Year: <year> | DvdCode: <dvdcode></p> <p style="text-align: justify;">We do not have a limit on the number of Books/AudioBooks/DVDs that our store can hold, and thus, ArrayLists would be useful here. You should have two ArrayLists: one for Books and one for DVDs and the ArrayLists should be typed accordingly (i.e., the code should not be declared unsafe upon compilation). You are *not allowed* to have a separate ArrayList for AudioBooks.</p> <p style="text-align: justify;">The distinction between Books and AudioBooks should be easy enough using the instanceof operator. Also there is no such thing as a standalone CatalogItem [Hint: this isn't a concrete class]. Meaning it's Abstract!</p> <p style="text-align: justify;">The menu option displayed would now look like:</p> <p style="text-align: justify;">**Welcome to the Comets Books and DVDs Store (Catalog Section)**</p> <p style="text-align: justify;">Choose from the following options:</p> <p style="text-align: justify;">1 - Add Book</p> <p style="text-align: justify;">2 - Add AudioBook</p> <p style="text-align: justify;">3 - Add DVD</p> <p style="text-align: justify;">4 - Remove Book</p> <p style="text-align: justify;">5 - Remove DVD</p> <p style="text-align: justify;">6 - Display Catalog</p> <p style="text-align: justify;">9 - Exit store</p> <p style="text-align: justify;">Then, within a loop, if the user enters an option that is not 1, 2, 3, 4, 5, 6, or 9, display the message "This option is not acceptable" and loop back to redisplay the menu. Continue in this manner until a correct option is input.</p> <p style="text-align: justify;">You may implement the methods however you want as long as you satisfy the class relationships, and satisfy the following behavior:</p> <p style="text-align: justify;"><strong>If options 1, 2 or 3</strong> are entered, follow-up by asking the User to enter the required details. Invalid values are not allowed: for example, a book must have a non-empty title and author, and a positive running time and price. An AudioBook must also have a positive running time. Similar restrictions apply on DVDs. If the User enters something invalid, prompt them to enter it again. If the User tries to add a Book or DVD that already exists (i.e., we already have a Book with that ISBN number or a DVD with that dvdcode) then let the User know that this is the case and return to the main menu. [Hint: Therefore, when options 1, 2 or 3 are entered, the first thing to ask the User for would be the ISBN number or the DVD code respectively].</p> <p style="text-align: justify;"><strong>If option 4</strong> is selected, ask the User to enter the ISBN number to remove: if it exists in the Catalog,t hen remove it; and if it doesn't then let the User know by saying "The Book doesn't exist in the Catalog" (and then return to the main menu). Similar behavior applies to <strong>option 5</strong>, except this time with DVDs. After successful removal, display the Catalog (i.e., the behavior of option 6, and redisplay the main menu).</p> <p style="text-align: justify;">If <strong>option 6</strong> is selected then display the entire Catalog to the User by displaying all the Book</p> <p style="text-align: justify;">information followed by all the DVD information, with the following line to separate the two.</p> <p style="text-align: justify;">The information for each Book or DVD must be displayed using the respective toString methods.</p> <p style="text-align: justify;">Continue the looping until <strong>option 9</strong> is selected, and when option 9 is entered, end the program.</p></span> </div></div></div> <div id="viewreadmore" class="que_link"> <a id="readmore" href="javascript:void(0);" style="font-size: 14px; color: #ff700c;" class="read-more-trigger mar_top10" onclick="changeheight(this)">View complete question</a> </div> <div class="innercanteenouter_inner_center3"> <p>Computer Engineering, <span>Engineering</span> </p> </div> <div class="clear"></div> </div> </div> <div class="innercanteenouter_inner_center6"> <div class="innercanteenouter_inner_center6_center7"> <div class="innercanteenouter_inner_center6_center"> <ul> <li class="innercanteenouter1"> Category:- <span>Computer Engineering</span> </li> <li class="innercanteenouter2"> Reference No.:- <span>M92504493 </span> </li> <li id="lrprice" class="innercanteenouter3"> Price:- <span>$10</span> </li> </ul> <div id="verified" class="innercanteenouter_inner_center6_center1"> <a>Verified Expert</a> </div> <div class="clear"></div> <input type="submit" name="btnASolution" value="Download Verified Solution File" id="btnASolution" class="innercanteenouter_inner_center6_center2" /> <p id="compare">Priced at <label class="priceold">$20</label> Now at $10, Verified Solution</p> </div> <div class="innerjohnanswered1"> <div class="innerjohnanswered1ftti"><h2></h2> <p></p> </div> <div class="clear"></div> </div> </div> </div> <div class="inneranswer"> <b>Have any Question?</b><span id="RequiredFieldValidator1" style="background-color:Yellow;visibility:hidden;">Write your Review or question?</span> <br /><br /> <div class="inneranswerhgrows"> <textarea name="txtReview" id="txtReview" class="inneranswerhgrowss" ValidationGroup="Review" placeholder=" Write your message!!"></textarea> </div> <div class="inneranswerhgrowsddf"> <input type="submit" name="btnReview" value="Have Question" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnReview", "", true, "Review", "", false, false))" id="btnReview" class="planpageinnerrightcontleftcommetgetquotebt" /> </div> </div> <br /> <div class="innerquestions"> <h2>Related Questions in Computer Engineering</h2> <table id="dlReviewList" cellspacing="0" style="width:100%;border-collapse:collapse;"> <tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_0"><b><a href='http://www.mywordsolution.com/question/question-sally-averages-5-strokes-a-hole-when-she-plays/93118815' target='_balnk' class='que_link' >Question sally averages 5 strokes a hole when she plays</a></b></span></h3> <p> <span id="dlReviewList_lblContent_0">Question: Sally averages 5 strokes a hole when she plays golf. One day, she took 40 strokes to complete the first nine holes. Her partner conjectured that she would probably regress to the mean and take 50 strokes to com ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_1"><b><a href='http://www.mywordsolution.com/question/information-systemsdirections-answer-the-following-if-you/93113429' target='_balnk' class='que_link' >Information systemsdirections answer the following if you</a></b></span></h3> <p> <span id="dlReviewList_lblContent_1">Information Systems Directions : Answer the following: If you were asked to develop a logical model of the registration system at a school, would it be better to use a top-down or bottom-up approach? Explain your reasoni ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_2"><b><a href='http://www.mywordsolution.com/question/question-what-are-the-risks-of-transmitting-data-over-an/93111969' target='_balnk' class='que_link' >Question what are the risks of transmitting data over an</a></b></span></h3> <p> <span id="dlReviewList_lblContent_2">Question : What are the risks of transmitting data over an unsecured Wi-Fi network? What steps are necessary to secure Wi-Fi Protected Access Network? Distinguish between client/server and file server architecture. Is te ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_3"><b><a href='http://www.mywordsolution.com/question/language-is-cgenerate-a-sparse-vector-class-with--operator/93125264' target='_balnk' class='que_link' >Language is cgenerate a sparse vector class with operator</a></b></span></h3> <p> <span id="dlReviewList_lblContent_3">Language is C++ Generate a sparse vector class with * operator, such as Vector Vector::operator * (Vector& param) A multiplication (*) operators returns element-wise multiplication of two vectors in another vector. Given ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_4"><b><a href='http://www.mywordsolution.com/question/frontier-services-has-a-2000-pure-discount-bond-that-comes/93133073' target='_balnk' class='que_link' >Frontier services has a 2000 pure discount bond that comes</a></b></span></h3> <p> <span id="dlReviewList_lblContent_4">Frontier Services has a $2,000 pure discount bond that comes due in one year. The risk-free rate of return is 4 percent. The firm's assets are expected to be worth either $2,800 or $1,600 in one year. Currently, these as ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_5"><b><a href='http://www.mywordsolution.com/question/assignment---dijkstra-algorithmdijkstras-algorithm-finds/93135368' target='_balnk' class='que_link' >Assignment - dijkstra algorithmdijkstras algorithm finds</a></b></span></h3> <p> <span id="dlReviewList_lblContent_5">Assignment - Dijkstra Algorithm Dijkstra's algorithm finds the shortest path from a given node to all other nodes. 1) We observe that we can modify this algorithm to stop as soon as a particular node is reached; thus pro ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_6"><b><a href='http://www.mywordsolution.com/question/can-someone-show-me-a-working-implementation-in-c-source/93122262' target='_balnk' class='que_link' >Can someone show me a working implementation in c source</a></b></span></h3> <p> <span id="dlReviewList_lblContent_6">Can someone show me a working implementation, in C source code, of a Linux shell that will use shared memory for command execution using pipes that read data from the shared memory region? For example: you type ls -1 | w ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_7"><b><a href='http://www.mywordsolution.com/question/a-study-sample-was-done-regarding-the-association-between/93133203' target='_balnk' class='que_link' >A study sample was done regarding the association between</a></b></span></h3> <p> <span id="dlReviewList_lblContent_7">A study sample was done regarding the association between family history and the risk of developing AD. Exposure were family history of AD and no family history of AD. Outcomes were development of AD or no development of ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_8"><b><a href='http://www.mywordsolution.com/question/imagine-a-small-city-chambana-with-a-labor-demand-function/93113564' target='_balnk' class='que_link' >Imagine a small city chambana with a labor demand function</a></b></span></h3> <p> <span id="dlReviewList_lblContent_8">Imagine a small city Chambana with a labor demand function E=200-1/2w and a labor supply function E=2w-100. Assume that there is a sudden influx of 40 perfect substitutes immigrants. a. How does this affect the natives i ...</span> </p> </div> </td> </tr><tr> <td> <div class="innerquestionsgtr"> <h3> <span id="dlReviewList_lblTitle_9"><b><a href='http://www.mywordsolution.com/question/a-five-question-multiple-choice-statistics-quiz-is-given/93109691' target='_balnk' class='que_link' >A five question multiple choice statistics quiz is given</a></b></span></h3> <p> <span id="dlReviewList_lblContent_9">A five question multiple choice statistics quiz is given. Each question has 3 possible choices, only one of which is correct. calculate the probability that of receiving a passing grade on the quiz, by randomly guessing ...</span> </p> </div> </td> </tr><tr> <td></td> </tr> </table> </div> <div class="innerlogo"> <ul> <li><div class="innerlogoback1"></div></li> <li><div class="innerlogoback2"></div></li> <li><div class="innerlogoback3"></div></li> </ul> </div> </div> <div class="innercanteenouter_inner_right"> <div class="innercanteenouter_inner_right1"> <div class="innercanteenouter_inner_right1pou"> <ul> <li class="red1"> <div class="counterDivTag">4,153,160 Questions Asked</div> </li> <li class="oring1"><div class="counterDivTag">13,132 Experts</div></li> <li class="grine1"><div class="counterDivTag">2,558,936 Questions Answered</div></li> </ul> <div class="clear"></div> <h2>Ask Experts for help!!</h2> </div> </div> <div class="innerchoose"> <h2>Looking for Assignment Help?</h2> <p> <b>Start excelling in your Courses, Get help with Assignment</b><br /><br /> Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time. </p> <a href="http://www.mywordsolution.com/free-quote-job-posting.aspx">Ask Now</a> <span>Help with Problems, Get a Best Answer</span> </div> <div class="innertranspoitation"> <div class="innertranspoitation1"> <ul> <li><a href="#">Recent Questions </a></li> </ul> <div class="clear"></div> </div> <table id="LeftSideControl1_RecentQuestion1_dlReviewList" cellspacing="0" style="width:100%;border-collapse:collapse;"> <tr> <td> <div class="innertranspoitation2"> <h3><span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblTitle_0"><b><a href='http://www.mywordsolution.com/question/why-might-a-bank-avoid-the-use-of-interest-rate-swaps-even/93137978' target='_balnk' class='que_link' >Why might a bank avoid the use of interest rate swaps even</a></b></span></h3> <p> <span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblContent_0">Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate</span> </p> </div> </td> </tr><tr> <td> <div class="innertranspoitation2"> <h3><span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblTitle_1"><b><a href='http://www.mywordsolution.com/question/describe-the-difference-between-zero-coupon-bonds-and/93137977' target='_balnk' class='que_link' >Describe the difference between zero coupon bonds and</a></b></span></h3> <p> <span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblContent_1">Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p</span> </p> </div> </td> </tr><tr> <td> <div class="innertranspoitation2"> <h3><span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblTitle_2"><b><a href='http://www.mywordsolution.com/question/compute-the-present-value-of-an-annuity-of--880-per-year/93137976' target='_balnk' class='que_link' >Compute the present value of an annuity of 880 per year</a></b></span></h3> <p> <span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblContent_2">Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As</span> </p> </div> </td> </tr><tr> <td> <div class="innertranspoitation2"> <h3><span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblTitle_3"><b><a href='http://www.mywordsolution.com/question/compute-the-present-value-of-an-1150-payment-made-in-ten/93137975' target='_balnk' class='que_link' >Compute the present value of an 1150 payment made in ten</a></b></span></h3> <p> <span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblContent_3">Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int</span> </p> </div> </td> </tr><tr> <td> <div class="innertranspoitation2"> <h3><span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblTitle_4"><b><a href='http://www.mywordsolution.com/question/compute-the-present-value-of-an-annuity-of--699-per-year/93137974' target='_balnk' class='que_link' >Compute the present value of an annuity of 699 per year</a></b></span></h3> <p> <span id="LeftSideControl1_RecentQuestion1_dlReviewList_lblContent_4">Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As</span> </p> </div> </td> </tr><tr> <td></td> </tr> </table> </div> </div> <div class="clear"></div> </div> <div class="clear"></div> </div> </div> <div class="footer"> <div class="footerouter"> <div class="footerouter_inner"> <div class="footerouter_left"> <ul> <li> <div class="footerouter_left1"> <ul> <li><a href="http://www.mywordsolution.com/homework-help/science/8">Science</a></li> <li><a href="http://www.mywordsolution.com/homework-help/english/390">English</a></li> <li><a href="http://www.mywordsolution.com/homework-help/biology/384">Biology</a></li> <li><a href="http://www.mywordsolution.com/homework-help/humanities/388">Humanities</a></li> </ul> </div> </li> <li> <div class="footerouter_left1"> <ul> <li><a href="http://www.mywordsolution.com/homework-help/engineering/9">Engineering</a></li> <li><a href="http://www.mywordsolution.com/homework-help/programming/10">Programming</a></li> <li><a href="http://www.mywordsolution.com/homework-help/computer-science/11">Computers/IT Courses</a></li> </ul> </div> </li> <li> <div class="footerouter_left1"> <ul> <li><a href="http://www.mywordsolution.com/homework-help/accounting/1">Accounting</a></li> <li><a href="http://www.mywordsolution.com/homework-help/finance/2">Finance</a></li> <li><a href="http://www.mywordsolution.com/homework-help/management/7">Management</a></li> <li><a href="http://www.mywordsolution.com/homework-help/statistics/6">Statistics</a></li> <li><a href="http://www.mywordsolution.com/homework-help/economics/5">Economics</a></li> <li><a href="http://www.mywordsolution.com/homework-help/taxation/4">Taxation</a></li> <li><a href="http://www.mywordsolution.com/homework-help/law/3">LAW Assignment Help</a></li> </ul> </div> </li> <li> <div class="footerouter_left1"> <ul> <li><a href="http://www.mywordsolution.com/homework-help/essay/13">Essay Writing Help</a></li> <li><a href="http://www.mywordsolution.com/homework-help/dissertation/12">Dissertation Help</a></li> <li><a href="http://www.mywordsolution.com/homework-help/thesis-writing/117">Thesis Help</a></li> <li><a href="http://www.mywordsolution.com/homework-help/literature-review/79">Literature Review</a></li> <li><a href="http://www.mywordsolution.com/homework-help/research-paper/78">Research Paper</a></li> <li><a href="http://www.mywordsolution.com/homework-help/solved-classroom-assignments/77">Solved Problems</a></li> <li><a href="http://www.mywordsolution.com/homework-help/popular-courses-and-coursework-help/82 ">Coursework Help</a></li> </ul> </div> </li> <div class="clear"></div> </li> </ul> </div> <div class="footerouter_right"> <div class="footerouter_right0"> <div class="footerpayment"> <div class="footerpaymentscur"></div> <div class="footerpaymentscard"> <ul> <li class="footerpaymentscard1"></li> <li class="footerpaymentscard2"></li> <li class="footerpaymentscard3"></li> <li class="footerpaymentscard4"></li> </ul> </div> </div> <div class="footerouter_right1"> <h2>Follow Us</h2> <ul> <li class="fb"><a href="http://www.facebook.com/Mywordsolution" rel="nofollow" target="_blank"></a></li> <li class="twt"><a href="http://www.twitter.com/Mywordsolution" rel="nofollow" target="_blank"></a></li> </ul> <div class="clear"></div> </div> </div> </div> <div class="clear"></div> </div> </div> <div class="footerbottom"> <div class="footerbottom_inner"> <ul> <li><a href="http://www.mywordsolution.com/">Home</a></li> <li><a href="http://www.mywordsolution.com/about-us.aspx">About Us</a></li> <li><a href="http://www.mywordsolution.com/blog/">Blog</a></li> <li><a href="http://www.mywordsolution.com/faqs.aspx">FAQs</a></li> <li><a href="http://www.mywordsolution.com/ask-question.aspx">Assignment Help</a></li> <li><a href="http://www.mywordsolution.com/homework-help.aspx">Homework Help</a></li> <li><a href="http://www.mywordsolution.com/contactus.aspx">Contact Us</a></li> <li><a href="http://www.mywordsolution.com/questions/archive/">Q&A</a></li> <li><a href="http://www.mywordsolution.com/directory.aspx">Directory</a></li> <li><a href="http://www.mywordsolution.com/sitemap.aspx">Sitemap</a></li> <li><a href="http://www.mywordsolution.com/refund-policy.aspx">Refund Policy</a></li> <li><a href="http://www.mywordsolution.com/privacy-policy.aspx">Privacy Policy</a></li> <li><a href="http://www.mywordsolution.com/terms-and-conditions.aspx">T & C </a></li> <li><a href="http://www.mywordsolution.com/disclaimer-policy.aspx">Disclaimer Policy</a></li> <li> <a href="http://www.mywordsolution.com/copyright-notice.aspx">Copyright Notice</a></li> </ul> <div class="clear"></div> <p>© Copyright 2013-14 <span>mywordsolution.com</span> All rights reserved </p> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-38762144-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.mywordsolution.com/library/js/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <!--Start of Tawk.to Script--> <script type="text/javascript"> var $_Tawk_API={},$_Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; s1.async=true; s1.src='https://embed.tawk.to/5584638c0ed4869955a0dce2/default'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })(); </script> <!--End of Tawk.to Script--> </div> </div> </div> <script type="text/javascript"> //<![CDATA[ var Page_Validators = new Array(document.getElementById("RequiredFieldValidator1")); //]]> </script> <script type="text/javascript"> //<![CDATA[ var RequiredFieldValidator1 = document.all ? document.all["RequiredFieldValidator1"] : document.getElementById("RequiredFieldValidator1"); RequiredFieldValidator1.controltovalidate = "txtReview"; RequiredFieldValidator1.errormessage = "Write your Review or question?"; RequiredFieldValidator1.validationGroup = "Review"; RequiredFieldValidator1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator1.initialvalue = ""; //]]> </script> <script type="text/javascript"> //<![CDATA[ var Page_ValidationActive = false; if (typeof(ValidatorOnLoad) == "function") { ValidatorOnLoad(); } function ValidatorOnSubmit() { if (Page_ValidationActive) { return ValidatorCommonOnSubmit(); } else { return true; } } //]]> </script> </form> </body> </html>