Question: Please submit one source code file ( . java file ) for each exercise. ( Ex . Lab 1 0 Ex 1 . java, Lab
Please submit one source code file java file for each exercise. Ex LabExjava, LabExjava, LabExjava etc
Remember to follow the commenting guidelines.
Program : Creating objects points:
Imagine you are working on a fleet simulation for the US Navy. Each ship will be an instance of its ship type.
Define a class with the following fields, methods, and constructor. Watch out to make the specified fields and methods private instead of public.
Using that class, create two instances of carriers:
Instance: CVN
Name"Nimitz"
Instance: CVN
Name"Doris Miller
Tons
Length
Personnel
Aircraft
Carriernewname: String :void
Carriernewname: String, newlength: int :void
Carriernewname: String, newlength: int, newpersonnel: int, newair:int :void
setTonsnewtons: int :void
getName :String
getTons :int
Submit both the java file with the Carrier class, and the java file with your main program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
