Question: In JAVA Develop a class definition for a Person. Then develop a class definition for a Military Person that inherits the properties of the Person,
In JAVA
Develop a class definition for a Person. Then develop a class definition for a Military Person that
inherits the properties of the Person, and a Navy Sailor that inherits the properties of a Military
Person. Finally, create two classes; an Officer and an Enlisted that each can inherit the properties of
a Navy Sailor. At each level, include the following class variables:
Person: FirstName, MiddleInitial, LastName, Gender
*
Military Person: Active Duty or Reserve
*
Navy Sailor: Base where stationed, Surface Ship or Submarine, Date Commissioned, Rank
Include a toString() method in each class that will print out what type of class it is. Include methods
read each of the class variables (i.e., getRank()) and methods to change the value of each class
variable. Finally, develop methods so that all of the information in an object can be printed out.
Write a short main() program to test it out.
Important Note: Be sure to incorporate the principles of encapsulation (Chapter 8) in your
definitions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
