Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 10, Problem 9E
Program Plan Intro
To order the given items into an inheritance hierarchy.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create an inheritance hierarchy that could be used to represent the following classes:accountant, customer, department, employee, manager, organization, and salesperson.
. Draw an inheritance hierarchy representing parts of a computer system (processor, memory, disk drive, DVD drive, printer, scanner, keyboard, mouse, etc.).
(BlueJ)
Draw an inheritance hierarchy for the people in your place of study or work. For example, if you are a university student, then your university probably has students (first-year students, second-year students, . . . ), professors, tutors, office personnel, etc.
Chapter 10 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Knowledge Booster
Similar questions
- Draw an inheritance hierarchy representing parts of a -computer system (processor, memory, disk drive, DVD drive, printer, scanner, keyboard, mouse, etc.).arrow_forwardCreate an inheritance hierarchy of Rodent: mouse, gerbil, hamster, guinea pig. In the base class, provide methods that are common to all rodents based on behaviours you find with a quick Internet search. Be sure to document the behaviours you implement (e.g., eat, sleep, groom, move, etc.). Each behaviour should print its action to standard output (e.g., rodent eating). Next, refine these behaviours in the child classes to perform different behaviours, depending on the specific type of rodent, but only if the behaviour is actually different (e.g., mouse eating seeds or guinea pig eating grass) Test your Rodent classes by writing a main() class and creating instances of every rodent, and demonstrate all the behaviours for each rodent.arrow_forwardCreate an inheritance hierarchy of Rodent: mouse, gerbil, hamster, guinea pig. In the base class, provide methods that are common to all rodents based on behaviours you find with a quick Internet search. Be sure to document the behaviours you implement (e.g., eat, sleep, groom, move, etc.). Each behaviour should print its action to standard output (e.g., rodent eating). Next, refine these behaviours in the child classes to perform different behaviours, depending on the specific type of rodent, but only if the behaviour is actually different (e.g., mouse eating seeds or guinea pig eating grass) Test your Rodent classes by writing a main() class and creating instances of every rodent, and demonstrate all the behaviours for each rodent. When solving can you write comments on the code explaining it.arrow_forward
- In what inheritance relationship might a touch pad and a mouse be? (We are talking about computer input devices here, not a small furry mammal.)arrow_forwardWhich of the following pairs have a relationship that is most similar to inheritance? Group of answer choices 1. A toy car and Car. 2. A Honda Civic and Car. 3. A car and an engine. 4. A lock and a key.arrow_forwardConsider a three-dimensional (3-D) geometric shape as a concept. Any such 3-D shape will have a volume and surface area, but until you know the nature of the shape and its attribute dimensions, these will be abstract in nature. Design and implement an inheritance hierarchy starting with a 3-D shape, then a set of at least three derived classes that define regular 3-D shapes such as a cube, sphere, cylinder. Include a UML class diagram showing the design. Any general 3-D shape will have a name, but few other attributes. For each derived shape, store fundamental attribute data about its dimensions, and provide methods to access and modify this data. In addition, provide appropriate methods to compute each shape’s volume and surface area. For example, a cube has a volume of s3 where s is the length of a side, whereas a sphere has a volume of 4πr3/3 where r is the radius. In terms of style, every class should have constructors and a toString() method that properly uses inheritance.…arrow_forward
- Implement the following hierarchy shown in Figure 1, using Java Inheritance. The class Student is the parent class. Note that all the variables are private and hence the child classes can only use them through accessor and mutator methods.arrow_forwardDevelop an inheritance hierarchy based upon a Polygon class that has abstract methods {{ area( ) and perimeter( ) }}, and three instance variables (attributes) of type int (number of dimensions), float (value of perimeter), and float (value of area). Your class must include a constructor method that initializes the int variable to an appropriate value. Implement classes Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon extend this base class (Polygon), with the obvious meanings for the area( ) and perimeter( ) methods. Also implement classes, IsoscelesTriangle, EquilateralTriangle, Rectangle, and Square, that have the appropriate inheritance relationships. Finally, write a simple program (to test your classes), that allows users to create polygons of the various types and input their geometric dimensions, and the program then outputs their area and perimeter. Allow users to input polygons by specifying their number of dimensions and be able to test if two such polygons are…arrow_forwardDevelop an inheritance hierarchy based upon a Polygon class that has abstract methods {{ area( ) and perimeter( ) }}, and three instance variables (attributes) of type int (number of dimensions), float (value of perimeter), and float (value of area). Your class must include a constructor method that initializes the int variable to an appropriate value. Implement classes Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon extend this base class (Polygon), with the obvious meanings for the area( ) and perimeter( ) methods. Also implement classes, IsoscelesTriangle, EquilateralTriangle, Rectangle, and Square, that have the appropriate inheritance relationships. Finally, write a simple program (to test your classes), that allows users to create polygons of the various types and input their geometric dimensions, and the program then outputs their area and perimeter. Allow users to input polygons by specifying their number of dimensions and be able to test if two such polygons are…arrow_forward
- List out some adjustments that can be done to increase the inheritance.arrow_forward(a) Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In the base class, providemethods that are common to all Rodents, and override these in the derived classes to perform differentbehaviors depending on the specific type of Rodent. Create an array of Rodent, fill it with different specific types of Rodents, and call your base-class methods to see what happens. (b) Create a Cycle class, with subclasses Unicycle, Bicycle and Tricycle. Demonstrate that an instance of eachtype can be upcast to Cycle via a ride( ) method. Using the above Cycle hierarchy, add a balance( ) methodto Unicycle and Bicycle, but not to Tricycle. Create instances of all three types and upcast them to an arrayof Cycle. Try to call balance( ) on each element of the array and observe the results. Downcast and callbalance( ) and observe what happens.arrow_forwardWhy do we use inheritance? when you want to combine classes. when a "is-a" relationship existswhen there is a "has-a" relationshiparrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education