Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you will create a set of simple classes that model a system that maintains a collection of library assets. The system utilizes

For this assignment you will create a set of simple classes that model a system that maintains a collection of library assets. The system utilizes abstract classes and polymorphism to enable an asset manager to keep track of books and periodicals as a single collection. Books are able to be checked out whereas periodicals cannot.

In addition to the classes described below, you will also need to provide a test driver - a separate class with a main() - to exercise the functionality of your system.

You will need to implement the following classes based on the description of their attributes and operations:

  • Asset - this class must be declared abstract, attributes are all private
    • name - the name of the asset
    • id - the unique id of the asset
    • isAvailable - a flag to indicate whether the asset is currently in the library
    • a constructor that requires the creator to supply the id of the asset and appropriately initializes an object
    • public operations to set and get the asset's name
    • public operation to get the asset's id
    • protected operation to get whether or not the asset is in the library
    • public, abstract operation to check out the asset, returns a boolean
    • public, abstract operation to check in the asset, returns a boolean
  • Book - this class is a subclass of Asset
    • authors - a collection (array) of the names the books authors
    • authorCount - the number of authors currently in the collection
    • a constructor that requires the creator to supply the id of the asset and appropriately initializes an object
    • public operations to add an author to the collection of authors and obtain the collection (array) of authors
    • an implementation of the the check out operation
      • if the asset is in the library, it is made unavailable and the operation returns true
      • if the asset is not in the library the operation returns false
    • an implementation of the the check out operation
      • if the asset is not the library, it is made available and the operation returns true
      • if the asset is already in the library the operation returns false
    • an override of toString() which returns a description of the book of the format
      • "" by <author1>, <author2>, ... :: <id></li> </ul> for example, <ul> <li>"Introduction to Algorithms" by Cormen, Leiserson, Rivest :: 123456 </li> </ul> </li> </ul> </li> <li>Periodical - this class is a subclass of Asset <ul> <li>volume - the volume number of the periodical</li> <li>issue - the issue number of the periodical</li> <li>a constructor that requires the creator to supply the id of the asset and appropriately initializes an object</li> <li>public operations to set and get the volume number</li> <li>public operations to set and get the issue number</li> <li>an implementation of the the check out operation <ul> <li>periodicals can't be checked out so this operation always returns false</li> </ul> </li> <li>an implementation of the the check out operation <ul> <li>since periodicals cannot be checked out this operation always returns true</li> </ul> </li> <li>an override of toString() which returns a description of the book of the format <ul> <li>"<title>", <volume>:<issue> :: <id></li> </ul> for example, <ul> <li>"Nature" 493:2 :: 9876543 </li> </ul> </li> </ul> </li> <li>AssetManager <ul> <li>assets - a collection (array) of assets, no two assets have the same id</li> <li>assetCount - the number of assets currently in the collection</li> <li>a constructor (no parameters) that appropriately initializes the object</li> <li>public operation to add an asset, returns a boolean <ul> <li>if there is no asset in the collection with the same id, the asset is added and true is returned</li> <li>if there is an asset in the collection with the same id, the asset is not added and false is returned</li> </ul> </li> <li>public operation to find an asset by id <ul> <li>if an asset with the id is in the collection it is returned</li> <li>if no asset with the id is in the collection null is returned</li> </ul> </li> </ul> </li> </ul> <p>Your submission will consist of a zip file containing just the necessary .java files. As always your code must meet the coding standards.</p> <p>Previous</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" loading="lazy" decoding="async" fetchpriority="low"> <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" 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" 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/fundamentals-of-database-system-7th-edition-9789332582705"> <img src="https://dsd5zvtm8ll6.cloudfront.net/si.question.images/book_images/64ec5d30a801c_47350.jpg" width="100" height="131" alt="Fundamentals Of Database System" loading="lazy"> </a> </div> <div class="bookInfo" > <h3 class="bookTitle"> <a href="/textbooks/fundamentals-of-database-system-7th-edition-9789332582705"> Fundamentals Of Database System </a> </h3> <div class="bookMetaInfo" > <p class="bookAuthor"> <b>Authors:</b> <span>Elmasri Ramez And Navathe Shamkant</span> </p> <p class="bookEdition"> 7th Edition </p> <p class="bookEdition"> 978-9332582705 </p> </div></div></div> <a href="/textbooks/computer-science-voip-2747" 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="/the-beach-dude-bd-employs-a-legion-of-current-and" > The Beach Dude (BD) employs a legion of current and former surfers as salespeople who push its surfing-oriented products to various customers (usually retail outlets). This case describes BD's sales... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/applied-calculus/calculate-the-following-integrals-3x4-4x3dx" > Calculate the following integrals. [(3x4 - 4x3)dx </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/modern-mathematical-statistics-with-applications/63-the-result-of-the-previous-exercise-suggests-how-observed-1989491" > 63. The result of the previous exercise suggests how observed values of two independent standard normal variables can be generated by rst generating their polar coordinates with an exponential rv... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/premier-printing-inc-has-not-been-profitable-despite-increases-in" > Premier Printing, Inc., has not been profitable despite increases in sales. It has hired you to learn why. You turn to the accounting system for data and find it to be a mess. However, you piece... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/how-would-you-determine-whether-a-company-has-an-operations-10009845" > How would you determine whether a company has an operations and supply chain strategy? What specific questions would you ask, and what information would you gather </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/valuestream-average-costing-abc-dbc-a-value-stream-has-three-1207138" > Value-Stream Average Costing, ABC, DBC A value stream has three activities and two products. The units produced and shipped per week are 50 of the limited model (Model K), characterized by special... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/001-part-1-of-3-100-points-the-scale-on-5045120" > 001 (part 1 of 3) 10.0 points The scale on the horizontal axis is 3 s per divi- sion and on the vertical axis 3 m per division. 5 position (x 3 m) 0 1 23 4 5 6 7 time (x 3 s) What is the time... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/sandeep-parikh-purchased-a-variable-life-vl-insurance-5364603" > Sandeep Parikh purchased a variable life ( VL ) insurance policy from the Homerun Insurance Company. Assuming Mr . Parikh's policy is a typical VL policy, it is correct to say that the subaccount... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/calculate-mean-median-standard-deviation-minimum-maximum-and-counts-n-5744417" > Calculate mean, median, standard deviation, minimum, maximum, and counts (n) for all variables in the POS Associates data set that are appropriate (i.e., that are quantitative variables or are... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/demetri-lives-in-the-city-and-sometimes-uses-a-ride-903275" > Demetri lives in the city and sometimes uses a ride share service. A ride costs $1.50 for the first mile and $0.25 for each additional mile. Demetri does not want to spend more than $3.75 on a ride.... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/required-information-exercise-1212-algo-indirect-preparing-statement-of-cash-825774" > Required information Exercise 12-12 (Algo) Indirect: Preparing statement of cash flows LO P2, P3, A1 [The following information applies to the questions displayed below.] The following financial... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/fundamentals-of-human-resource-management/3-behavior-ask-whether-the-trainees-onthejob-behavior-changed-because-2106293" > 3. Behavior. Ask whether the trainees on-the-job behavior changed because of the training program. For example, are employees in the stores complaint department more courteous toward disgruntled... </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/fundamentals-of-human-resource-management/1-a-wellthoughtout-orientation-program-is-essential-for-all-new-2106295" > 1. A well-thought-out orientation program is essential for all new employees, whether they have experience or not. </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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/fundamentals-of-human-resource-management/2-learning-test-the-trainees-to-determine-whether-they-learned-2106292" > 2. Learning. Test the trainees to determine whether they learned the principles, skills, and facts they were supposed to learn. </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/assume-that-the-riskfree-rate-is-3-and-that-the-8271683">Previous Question</a> <a class="nextQuestionButton" href="/study-help/questions/a-certain-dealer-owns-a-warehouse-that-can-store-a-8271685">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=8271684&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>