Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

Id probably just get more upset. Its bett er to just drop it.

Answered: 1 week ago