Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA java Question 5 (26 marks) A family of classes are being designed to store information about ships. There will be an abstract class called
JAVA java
Question 5 (26 marks) A family of classes are being designed to store information about ships. There will be an abstract class called Ship, and an Interface called IShip. Ship will have all the expected constructors, accessors and mutators to support the fol- lowing class fields serialNum: a real number, year: an integer; engine: an Engine object. IShip will have one abstract method: destinationCheck: given an integer import (dist) calculate the time (a real number) it would take to move that distance. You may assume for this question that the abstract class and the interface have been completed and are available for your use. Design a class called StarShip. This class inherits from Ship, implements Iship and is responsible for the following information: lightSpeed: a integer number between 2 and 10 (inclusive) specifying how close to light speed the ship can travel; Two StarShip objects are considered equal if and only if ALL of their classfields are the same. The destination check for StarShip is determined by the following formula: distance time = 7 lightSpeed - 100 You are required to write the following methods: . Alternate constructor, Copy constructor (but not clone), Accessors, equals, and All inherited abstract methods Your design must include all of the good features that have been discussed in the lec- tures and worksheet exercisesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started