Question
(1) Design a class named Capybara that holds attributes for a capybara's length, age, and name. Include methods to set and get each of these
(1) Design a class named Capybara that holds attributes for a capybara's length, age, and name. Include methods to set and get each of these attributes. Create theclass diagramand write theclass pseudocodethat defines the class. (You can use Word to create the class diagram--click Insert, Table, then mouseover to a 1x3 table. Fill in the values from there.) The chapter has several examples of class diagrams and class pseudocode.
(2) Create small program that declares two Capybara objects (using the class above) and sets each capybara's length, age, and name attributes. The program must also output each capybara's length, age, and name after they are set. Figure 10-4 is an example of a similar program--it declares one Employee object, then sets two attributes and outputs one attribute.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started