Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question Consider the following class diagram. Animal # a_name: char # id: int + setData(a_name, id); void + displayData(void): void Bird - eyeColour: char +

Question

Consider the following class diagram.

Animal

# a_name: char

# id: int

+ setData(a_name, id); void

+ displayData(void): void

Bird

- eyeColour: char

+ Bird(a_name, id, eyeClour)

+ ~ Bird()

+ setData(a_name, id); void

+ setColour(eyeColour); void

+ displayName(void): void

+ displayId(void): void

+ displayColour(void): void

Figure 1

You are requested to write code for the following tasks based on the class diagram given above.

Create an Animal class. The class must contain: (6 marks)

Variables

Functions

Create a Bird class. The class must contain: (18 marks)

Variables

Constructor

Destructor

Functions

Create a form that allow user to enter the Bird details. Write code to perform form validation as follows:

Use appropriate input types to capture the name, id and eye colour from the user.

Alert the user if any of the data fields are empty.

Use HTML pattern to ensure the name input must be minimum of two and maximum of ten letters.

Use HTML pattern to ensure the id input must be minimum of three and maximum of five-alphanumeric data.

(12 marks)

Create an object of Bird Class. Assign the user input to the object.

(4 marks)

Present the data in a table. Display the id, name and eye colour values of the Brid object as shown in Table 1. Apply the CSS class selector in your table design. (10 marks)

Table 1

Brid

</p> </td> </tr> <tr> <td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:173px"> <p><strong>ID</strong></p> </td> <td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:199px"> <p><strong>Name</strong></p> </td> <td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:166px"> <p><strong><em>Eye Colour</em></strong></p> </td> </tr> <tr> <td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:173px"> <p><display the data here></p> </td> <td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:199px"> <p><display the data here></p> </td> <td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:166px"> <p><display the data here></p> </td> </tr> <tr> <td colspan="3" style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:27px; vertical-align:top; width:538px"> <p><insert a picture here></p> </td> </tr> </tbody> </table> <p> </p> <p><strong>END OF QUESTION PAPER</strong></p> <p> </p> <p> </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/machine-learning-and-knowledge-discovery-in-databases-european-conference-ecml-pkdd-2016-riva-del-garda-italy-september-19-23-2016-proceedings-part-1-lnai-9851-1st-edition-978-3319461274-176444"> <img src="https://dsd5zvtm8ll6.cloudfront.net/si.question.images/book_images/2024/01/6597fdffd1e87_7756597fdffce19a.jpg" width="100" height="131" alt="Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851" loading="lazy"> </a> </div> <div class="bookInfo" > <h3 class="bookTitle"> <a href="/textbooks/machine-learning-and-knowledge-discovery-in-databases-european-conference-ecml-pkdd-2016-riva-del-garda-italy-september-19-23-2016-proceedings-part-1-lnai-9851-1st-edition-978-3319461274-176444"> Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851 </a> </h3> <div class="bookMetaInfo" > <p class="bookAuthor"> <b>Authors:</b> <span>Paolo Frasconi ,Niels Landwehr ,Giuseppe Manco ,Jilles Vreeken</span> </p> <p class="bookEdition"> 1st Edition </p> <p class="bookEdition"> 3319461273, 978-3319461274 </p> </div></div></div> <a href="/textbooks/computer-science-dynamic-graphs-2690" 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="/describe-the-differences-between-principalagent-conflicts-and-principal-principal-conflicts" > Describe the differences between principal-agent conflicts and principal- principal conflicts. </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="/mooresville-corporation-manufactures-reproductions-of-eighteenthcentury-classicalstyle-furniture-it-uses" > Mooresville Corporation manufactures reproductions of eighteenth-century, classical-style furniture. It uses a job costing system that applies factory overhead on the basis of direct labor hours.... </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/forensic-and-legal-psychology/which-of-the-following-identifies-the-parenting-style-most-likely-2101634" > Which of the following identifies the parenting style most likely to ground a teen who had missed a curfewand to explain the rationale for doing so, after considering the teens reasons? a.... </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="/haaki-shop-inc-is-a-large-retailer-of-surfboards-the" > Haaki Shop, Inc. is a large retailer of surfboards. The company assembled the information shown below for the quarter ended May 31: Total Sales Revenue... </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/question-consider-the-following-class-diagram-animal-aname-char-12491040" > Question Consider the following class diagram. Animal # a_name: char # id: int + setData(a_name, id); void + displayData(void): void Bird - eyeColour: char + Bird(a_name, id, eyeClour) + ~ Bird() +... </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/a-content-x-o-9-c-a-learnhumbercaultracourses1861751cioutline-4707030" > a Content x + O ( 9 C' a learn.humber.ca/ultra/courses/_186175_1/ci/outline i} G *- Quantitative Methods - BSTA-320-D8A Tests and Quizzes Quiz 4 - Posterior Probabilities \\s/ Kipling can pay for a... </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/you-have-to-choose-from-the-give-4-optionsaccounts-payableaccounts-1587164" > you have to choose from the give 4 optionsaccounts payableaccounts receivableadvertising expensecash Machinery and Equipment Repair Service is owned by William Giese. Use the above figures to prepare... </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/view-policies-current-attempt-in-progress-the-current-sections-of-1887711" > View Policies Current Attempt in Progress The current sections of Sunn Inc's balance sheets at December 31, 2021 and 2022, are presented here. Sunn's net income for 2022 was $153,000. Depreciation... </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/two-factories-i-and-ii-produce-phones-for-brand-abc-3420803" > Two factories I and II produce phones for brand ABC. Factory I produces 60% of all ABC phones and Factory II produces 40%. 10% of the phones from Factory I are defective, and 20% of those produced 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">★</span><span class="star">★</span> </div> </div> <a class="relatedQuestionText" href="/study-help/questions/at-the-beginning-of-the-year-sandhill-company-had-total-2031854" > At the beginning of the year, Sandhill Company had total assets of $883,000 and total liabilities of $368,000. Answer the following questions. (a) If total assets increased $151,000 during the year... </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/michael-participates-in-several-motocross-races-he-has-won-8-2076047" > Michael participates in several motocross races. He has won 8 more silver medals than gold medals. The number of bronze medals he has won is half that of the silver medals. If he has won 27 medals in... </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/international-human-resource-management/nationwide-financial-a-5000employee-life-insurance-company-based-in-columbus-2118495" > Nationwide Financial, a 5,000-employee life insurance company based in Columbus, Ohio, found that its management development program contained four types of managers. One type, unknown leaders, have... </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/international-human-resource-management/you-have-been-asked-to-evaluate-whether-your-organizations-current-2118497" > You have been asked to evaluate whether your organizations current pay structure makes sense in view of what competing organizations are paying. How would you determine what organizations to compare... </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/international-human-resource-management/the-chapteropening-story-described-how-employers-are-shifting-more-employee-2118498" > The chapter-opening story described how employers are shifting more employee health care costs to employees. What are the likely consequences of this change? Where does the social responsibility of... </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/the-following-is-the-contents-in-the-file-called-studentdatatxt-12491039">Previous Question</a> <a class="nextQuestionButton" href="/study-help/questions/consider-an-investment-that-has-cash-flows-of-500-the-12491041">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="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=12491040&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>