Access over 35 million academic & study documents

6 (10 pts) Explain why the following class hierarchy is not reasona

Content type
User Generated
Showing Page:
1/4
6. (10 pts) Explain why the following class hierarchy is not
reasonable:
DefenseDepartmentGeneral
Private
7. (10 pts) Give at least one example of a reasonable field
for each of the following classes in the following class
hierarchy. Be sure that the field is at the right level in the
hierarchy.
Vehicle
Car
Airplane
Passenger
Fighter
Bomber
SpaceShip
8. (10 pts) Give at least one example of a reasonable
method for each of the following classes in the following
class hierarchy. Be sure that the method is at the right
level in the hierarchy. Constructors, getters and setters
don\'t count for this problem.
Vehicle
Car
Airplane
Passenger
Fighter
Bomber
SpaceShip
9. (10 pts) Are a Private and a Platoon in an encapsulation
or an inheritance relationship? Explain
10. (10 pts) Present reasonable parent and child classes
for the class Tree (the biological kind). Give a short
explanation for why the classes you are proposing are in
good parent-child relationships.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/4
Solution
6)
DefenseDepartmentGeneral
Generally we will keep the names to the classes related to
the area which we want to make it a class.Based on that
as we observed the class name
DefenseDepartmentGeneral.Means its related to the
DefenseDepartment.So it might have some crucial or
sensitive information.If we provide sub class to that
DefenseDepartmentGeneral class then the sub class can
access the methods of the super class and also the super
class variables.This leads to the security issues.So it not
recommended to make subclass to the
DefenseDepartmentGeneral.
7)
Class Name ------ Field Name
Vehicle Number_of_wheels
Car steering_type (or) brakes_type
Airplane type_of_plane(for commercial
purpose or for cargo)

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/4

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 4 pages?
Access Now
Unformatted Attachment Preview
6. (10 pts) Explain why the following class hierarchy is not reasonable: DefenseDepartmentGeneral Private 7. (10 pts) Give at least one example of a reasonable field for each of the following classes in the following class hierarchy. Be sure that the field is at the right level in the hierarchy. Vehicle Car Airplane Passenger Fighter Bomber SpaceShip 8. (10 pts) Give at least one example of a reasonable method for each of the following classes in the following class hierarchy. Be sure that the method i s at the right level in the hierarchy. Constructors, getters and setters don\'t count for this problem. Vehicle Car Airplane Passenger Fighter Bomber SpaceShip 9. (10 pts) Are a Private and a Platoon in an encapsulation or an inheritance relationship? Expl ain 10. (10 pts) Present reasonable parent and child classes for the class Tree (the biological kind). Give a short explanation for why the classes you are proposing are in good parent-child relationships. Solution 6) DefenseDepartmentGeneral Generally we will keep the names to the classes related to the area which we want to make it a class.Based on that as we observed the class name DefenseDepartmentGeneral.Means its related t ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4