Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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>For AudioBooks it would be the same for books, except the price would be the discounted price and we</p> <p>would append: | RunningTime: <runningtime>.</p> <p>For DVDs it would be:</p> <p>Title: <title> | Director: <director> | Price: <price> | Year: <year> | DvdCode: <dvdcode></p> <p>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>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>The menu option displayed would now look like:</p> <p> </p> <p>**Welcome to the Comets Books and DVDs Store (Catalog Section)**</p> <p>Choose from the following options:</p> <p>1 - Add Book</p> <p>2 - Add AudioBook</p> <p>3 - Add DVD</p> <p>4 - Remove Book</p> <p>5 - Remove DVD</p> <p>6 - Display Catalog</p> <p>9 - Exit store</p> <p> </p> <p>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>You may implement the methods however you want as long as you satisfy the class relationships, and satisfy the following behavior:</p> <p> </p> <p><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> </p> <p><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> </p> <p>If <strong>option 6</strong> is selected then display the entire Catalog to the User by displaying all the Book</p> <p>information followed by all the DVD information, with the following line to separate the two.</p> <p>The information for each Book or DVD must be displayed using the respective toString methods.</p> <p>Continue the looping until <strong>option 9</strong> is selected, and when option 9 is entered, end the program.</p> </div> </section> <section class="answerHolder"> <div class="answerHolderHeader"> <div class="answer-heading"> <h2>Step by Step Solution</h2> </div> <div class="answerReviews"> <div class="starReview"> <div class="starIcon"> </div> <div class="starText"> </div> </div> </div> </div> <div class="answerSteps"> <p>There are <span>3</span> Steps involved in it</p> <div class="step"> <h3>Step: 1</h3> <img src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-text-image.webp" width="759" height="271" alt="blur-text-image" decoding="async" fetchpriority="high"> <div class="step1Popup"> <h3>Get Instant Access to Expert-Tailored Solutions</h3> <p>See step-by-step solutions with expert insights and AI powered tools for academic success</p> <button class="view_solution_btn step1PopupButton">View Solution</button> </div> </div> <div class="step"> <h3 class="accordion">Step: 2</h3> <div class="panel"> <img src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp" width="975" height="120" alt="blur-text-image_2" loading="lazy" decoding="async" fetchpriority="low"> <button class="view_solution_btn stepPopupButton">Sign Up to view</button> </div> </div> <div class="step"> <h3 class="accordion">Step: 3</h3> <div class="panel"> <img src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp" width="975" height="120" alt="blur-text-image_3" loading="lazy" decoding="async" fetchpriority="low"> <button class="view_solution_btn stepPopupButton">Sign Up to view</button> </div> </div> </div> </section> </div> <div class="expertRight"> <section class="AIRedirect"> <div class="AIHolder"> <h2>Ace Your Homework with AI</h2> <p>Get the answers you need in no time with our AI-driven, step-by-step assistance</p> <a class="AILink" href="/ask_ai">Get Started</a> </div> </section> <section class="relatedBook"> <div class="bookHolder" > <div class="relatedBookHeading" > <h2>Recommended Textbook for</h2> <object class="freeTagImage" type="image/svg+xml" data="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/document_product_info/free.svg" name="free-book-icon"></object> </div> <div class="bookMainInfo" > <div class="bookImage" > <a href="/textbooks/accounting-and-auditing-research-and-databases-practitioner-s-desk-reference-1st-edition-9781118334423"> <img src="https://dsd5zvtm8ll6.cloudfront.net/si.question.images/book_images/6304a79d41a80_12170.jpg" width="100" height="131" alt="Accounting And Auditing Research And Databases Practitioner's Desk Reference" loading="lazy"> </a> </div> <div class="bookInfo" > <h3 class="bookTitle"> <a href="/textbooks/accounting-and-auditing-research-and-databases-practitioner-s-desk-reference-1st-edition-9781118334423"> Accounting And Auditing Research And Databases Practitioner's Desk Reference </a> </h3> <div class="bookMetaInfo" > <p class="bookAuthor"> <b>Authors:</b> <span>Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson</span> </p> <p class="bookEdition"> 1st Edition </p> <p class="bookEdition"> 1118334426, 978-1118334423 </p> </div></div></div> <a href="/textbooks/computer-science-source-2601" class="viewMoreBooks">More Books</a> </div> </section> </div> </div> <section class="relatedQuestion"> <div class="relatedQuestionHolder"> <h4>Students also viewed these Databases questions</h4> <div class="relatedQuestionSliderHolder"> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/what-is-dmaic-list-and-briefly-describe-the-steps-involved" > What is DMAIC? List and briefly describe the steps involved in DMAIC. </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/calculus-early-transcendentals/prove-that-for-a-0" > Prove that for a 0. lim </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/fundamentals-of-human-resource-management/viewing-the-family-and-medical-leave-act-from-the-perspective-2110907" > Viewing the Family and Medical Leave Act from the perspective of a working department manager, describe the ways in which this legislation has affected a supervisors ability to manage. </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/excel-electronics-is-nearing-completion-of-a-threeyear-project-to" > Excel Electronics is nearing completion of a three-year project to develop and produce a new pocket Phone-Fax-Internet device (PFI). The PFI is no larger than a cigarette pack but has all the power... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/java-programming-question-develop-an-online-store-which-sells-dvds-13087139" > 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... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/explain-how-we-account-for-a-cost-that-creates-an-11144851" > Explain how we account for a cost that creates an immediate benefit versus a cost that creates a future benefit </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/at-december-31-2024-coronado-corporation-had-the-following-stock-1588152" > At December 31, 2024, Coronado Corporation had the following stock outstanding. 10% cumulative preferred stock, $100 par, 108,382 shares Common stock, $5 par, 4,028,120 shares $10,838,200 20,140,600... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/identify-and-compute-net-operating-assets-following-is-the-balance-6338530" > Identify and Compute Net Operating Assets Following is the balance sheet for Lowe's Companies Inc. LOWE'S COMPANIES INC. Consolidated Balance Sheet $ millions, except par value Feb. 1, 2019 Current... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/sandstone-corporation-has-the-following-account-balances-and-respective-fair-901699" > Sandstone Corporation has the following account balances and respective fair values on June 30: Items Book Values Fair Values Receivables Patented technology Computer software In-process research and... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/1-the-binary-equivalent-of-20-is-a-00011010-b-11992362" > 1. The binary equivalent of 20 is (a) 00011010 (b) 00100000 (c) 10100000 (d) 00010100 2. The code where all successive numbers differ from their preceding number by... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/1-from-the-following-mention-the-characteristies-of-social-problems-11992364" > 1. From the following, mention the characteristies of social problems (a) have some common basis of origin (b) interrelated (c) occurs in all societies (d) all these 2. From the following which type... </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/managing-human-behavior-in-public/15-on-very-controversial-issues-it-often-is-best-to-2124804" > 15. On very controversial issues, it often is best to delay or avoid your involvement as long as possible. </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/managing-human-behavior-in-public/12-it-is-advisable-to-always-tell-people-everything-you-2124801" > 12. It is advisable to always tell people everything you know about a situation. </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> <div class="relatedQuestionCart "> <div class="relatedQuestionCartHeader"> <h3>Question</h3> <div class="relatedStarRating"> <span class="star active">★</span><span class="star active">★</span><span class="star active">★</span><span class="star active half">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/managing-human-behavior-in-public/14-reaching-organizational-goals-requires-that-organizational-politics-and-power-2124803" > 14. Reaching organizational goals requires that organizational politics and power be avoided whenever possible. </a> <div class="relatedQuestionCartFooter"> <div class="relatedHistory"> <p> Answered: <span>1 week ago</span> </p> </div> </div> </div> </div> </div> </section> <hr class="expert-separator"> <div class="next-previous-button"> <div class="navigationButtons"> <a class="previousQuestionButton" href="/study-help/questions/import-javautilscanner-public-class-errors-public-static-void-main-13087138">Previous Question</a> <a class="nextQuestionButton" href="/study-help/questions/please-help-with-this-lab-in-c-78-ch7-lab-13087140">Next Question</a> </div> </div> </div> <div class="promo items-center justify-center hidden" style="margin-left:-15px;"> <div class="app_promo"> <div class="app_promo_headline"> <img class="app_promo_icon" alt="Mobile App Logo" width="40" height="40" loading="lazy" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png"> <p class="app_promo_title font-sans items-center">View Answer in SolutionInn App</p> </div> <button class="app_promo_action redirection question_open_url='q_id=13087139&q_type=2'"> Download on the App Store </button> <button class="btn btn-default app_promo_dismiss"> Continue with the mobile website </button> </div> </div> </main> </div> <div class="blank-portion"></div> <footer> <div class="container footerHolder"> <div class="footerLinksFlex"> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Services</p> <ul> <li><a href="/site-map">Sitemap</a></li> <li><a href="/fun/">Fun</a></li> <li><a href="/study-help/definitions">Definitions</a></li> <li><a href="/tutors/become-a-tutor">Become Tutor</a></li> <li><a href="/study-help/categories">Study Help Categories</a></li> <li><a href="/study-help/latest-questions">Recent Questions</a></li> <li><a href="/study-help/questions-and-answers">Expert Questions</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Company Info</p> <ul> <li><a href="/security">Security</a></li> <li><a href="/copyrights">Copyrights</a></li> <li><a href="/privacy">Privacy Policy</a></li> <li><a href="/conditions">Terms & Conditions</a></li> <li><a href="/solutioninn-fee">SolutionInn Fee</a></li> <li><a href="/scholarships">Scholarship</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Get In Touch</p> <ul> <li><a href="/about-us">About Us</a></li> <li><a href="/support">Contact Us</a></li> <li><a href="/career">Career</a></li> <li><a href="/jobs">Jobs</a></li> <li><a href="/support">FAQ</a></li> <li><a href="/campus-ambassador-program">Campus Ambassador</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-12"> <p>Secure Payment</p> <div class="footerAppDownloadRow"> <div class="downloadLinkHolder"> <img src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/common/footer/secure_payment_method.png" class="img-fluid mb-3" width="243" height="28" alt="payment-verified-icon" loading="lazy"> </div> </div> <p>Download Our App</p> <div class="footerAppDownloadRow"> <div class="downloadLinkHolder mobileAppDownload col-md-6 col-lg-6 col-sm-6 col-6 redirection" data-id="1"> <img style="cursor:pointer;" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/home_page/google-play-svg.svg" alt="SolutionInn - Study Help App for Android" width="116" height="40" class="img-fluid mb-3 " loading="lazy"> </div> <div class="downloadLinkHolder mobileAppDownload col-md-6 col-lg-6 col-sm-6 col-6 redirection" data-id="2"> <img style="cursor:pointer;" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/home_page/apple-store-download-icon.svg" alt="SolutionInn - Study Help App for iOS" width="116" height="40" class="img-fluid mb-3" loading="lazy"> </div> </div> </div> </div> </div> <div class="footer-bottom"> <p>© 2024 SolutionInn. All Rights Reserved</p> </div></footer> <script> window.addEventListener("load",function(){jQuery(document).ready(function(t){t.ajax({type:"POST",url:"/",data:{trackUserActivity:!0,reqUri:document.URL,referer:document.referrer},success:function(t){}})})},!1),window.addEventListener("load",function(){jQuery(document).ready(function(t){t.ajax({type:"POST",url:"/",data:{insertCrawler:!0,reqUri:document.URL,parseTime:"0.056",queryTime:"0.01654768548584",queryCount:"30"},success:function(t){}})})},!1),window.addEventListener("load",function(){jQuery(document).ready(function(){function t(t="",n=!1){var i="itms-apps://itunes.apple.com/app/id6462455425",e="openApp://action?"+t;isAndroid()?(setTimeout(function(){return window.location="market://details?id=com.solutioninn.studyhelp",!1},25),window.location=e):isIOS()?(setTimeout(function(){return window.location=i,!1},25),window.location=e):(i="https://apps.apple.com/in/app/id6462455425",n&&(i="https://play.google.com/store/apps/details?id=com.solutioninn.studyhelp"),window.open("about:blank","_blank").location.href=i)}jQuery("#appModal").modal("show"),jQuery(".download-app-btn").click(function(){t(jQuery(this).attr("question_open_url"))}),jQuery(".redirection").click(function(){var n=jQuery(this).attr("question_open_url"),i=jQuery(this).attr("data-id");void 0!=n?1==i?t(n,!0):t(n,!1):1==i?t("",!0):t("",!1)}),jQuery(".app-notification-close").click(function(){jQuery(".app-notification-section").css("visibility","hidden");var t=new FormData;t.append("hide_notification",!0),jQuery.ajax({type:"POST",url:"/",data:t,cache:!1,contentType:!1,processData:!1,beforeSend:function(){},success:function(t){location.reload()}})})})},!1); </script> </body> </html>