Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Following the steps and Using Java OO language to create java classes and subclasses. Each concrete class need to have a toString() method to define

Following the steps and Using Java OO language to create java classes and subclasses. Each concrete class need to have a toString() method to define that prints out its attributes.

The attributes must be private! Error checking is necessary.

image text in transcribed

image text in transcribed

image text in transcribed

Step 1:Define an interface Contact 1. That has the following methods (notice that some are for type String, this means you'll have to convert them to int's) 1. getLength/setLength (int) 2. getSpeed/setSpeed (int) 3. setSpeed(String) 4. getName/setName (String) 5. getType/setType (String) (This is an arbitrary string label for anything of class Contact) Step 2: Define an abstract class Ship that implements the Contact Interface. The methods in contact should be defined (no longer abstract, but they can be overriden later on). Step 3: Define a class Destroyer that subclasses Ship 1. that has the following attributes and get/set methods. Supports int and String setNumberMissiles() arguments. If the String argument of setNumberMissiles(0 encounters a parsing error, set the numberMissiles to 2. 1. numberMissile

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

Students also viewed these Databases questions