Big Java Late Objects
Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
Question
Book Icon
Chapter 9, Problem 1RE
Program Plan Intro

Subclass:

  • A class which is derived from some other class is called a subclass.
  • The subclass inherits the state and behaviour of its ancestor class.
  • It is also called a child class

Super class:

  • Super class is the class from which a subclass can be derived.
  • Super class allows the subclass to inherit its state and the behaviour.
  • It is also called a parent class.

Expert Solution
Check Mark

Explanation of Solution

a.

Given:

Superclass: “Employee”

Subclass: “Manager”

Reason:

  • The class “Employee” is super class because, every manager is an employee but not the other way around.
  • The “Manager” class is more specialized and will contain only the data of employees whose designation is manager.
  • But the class “Employee” will contain all the properties and behavior of an employee. The employees may have the designation such as manager, salesman, accountant, marketing executive and many more.

Explanation of Solution

b.

Given:

Superclass: “Student”

Subclass: “GraduateStudent”

Reason:

  • The class “Student” is super class because it will contain all the students in a collage.
  • The class “GraduateStudent” is subclass of “Student” because, it will contain only the details of students they are graduating in that year.
  • So, “GraduateStudent” can inherit all the properties and behaviour from the class “Student”.

Explanation of Solution

c.

Given:

Superclass: “Person”

Subclass: “Student”

Reason:

  • The class “Person” is super class because it will the details of a person who can be a child, a student, an employee and so on.
  • The class “Student” is subclass of “Person” because, it stands for a particular set of persons who are studying.
  • So, all the states and properties of a person applicable to every student, and all these properties can be inherited from the super class.

Explanation of Solution

d.

Given:

Superclass: “Employee”

Subclass: “Professor”

Reason:

  • The class “Employee” is super class because, every professor is an employee but not the other way around.
  • The “Professor” class is more specialized and will contain only the data of employees whose designation is a professor.
  • But the class “Employee” will contain all the properties and behavior of an employee. The employees may have the designation such as manager, salesman, professor, accountant, marketing executive and many more.

Explanation of Solution

e.

Given:

Superclass: “BankAccount”

Subclass: “CheckingAccount”

Reason:

  • The class “BankAccount” is more general and it will contain the data of every accounts. This class will contain the properties like account number, name, balance, transaction and methods like deposit (), withdraw () and more.
  • The classes “CheckingAccount” is a type of account and it also contains the properties like account number, name, balance, transaction and methods like deposit (), withdraw ().
  • One can use the properties and methods of “BankAccount” class in the “CheckingAccount” class.

Explanation of Solution

f.

Given:

Superclass: “Vehicle”

Subclass: “Car”

Reason:

  • The class “Vehicle” is more general and represents every type of vehicle such as, Car, Truck, Bus and many more.
  • The class “Car” is more specific and it only represents a vehicle, car. So, the class “Car” can inherit all the properties and behaviours of class “Vehicle”.

Explanation of Solution

g.

Given:

Superclass: “Vehicle”

Subclass: “Minivan”

Reason:

  • The class “Vehicle” is more general and represents every type of vehicle such as, Car, Truck, Bus and many more.
  • The class “Minivan” is more specific and it only represents a vehicle, minivans. So, the class “Minivan” can inherit all the properties and behaviours of class “Vehicle”.

Explanation of Solution

h.

Given:

Superclass: “Car”

Subclass: “Minivan”

Reason:

  • The class “Car” is more general and represents every type of cars such as, Van, Minivan, Pickup, Truck, Roadster and many more.
  • The class “Minivan” is more specific and it only represents a van, minivans. So, the class “Minivan” can inherit all the properties and behaviours of class “Car”.

Explanation of Solution

i.

Given:

Superclass: “Vehicle”

Subclass: “Truck”

Reason:

  • The class “Vehicle” is more general and represents every type of vehicle such as, Car, Truck, Bus and many more.
  • The class “Truck” is more specific and it only represents a vehicle, truck. So, the class “Truck” can inherit all the properties and behaviours of class “Vehicle”.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!

Chapter 9 Solutions

Big Java Late Objects

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education