Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

D.Implement the class Fleet that has as data an array of n aircrafts. a) Write the constructor, which creates an empty collection of Aircrafts. The

image text in transcribed

image text in transcribed

D.Implement the class Fleet that has as data an array of n aircrafts.

a) Write the constructor, which creates an empty collection of Aircrafts. The size of this array is passed as a parameter to the constructor of the class Fleet

b) Write the method addAircraft (A: Aircraft) which adds a CivilAircraft or a Fighter object to the collection.

c) Write the method aircraftAt(ind: int) which returns the aircraft in the collection at the index ind if the index is valid. Otherwise, it should return null.

d) Write the method fastestAircraft ( ) which returns the aircraft with the max speed in the collection.

> Comparable + compareTo(o:E):int 1 Aircraft - speed: double + Aircraft(speed: double) +toString():String + allowedWeight(): double Fleet - aircrafts: Aircraft[] + Fleet(size: int) + addAircraft (a: Aircraft): void + aircraftAt(ind:int): Aircraft +fastestAircraft(): Aircraft Fighter -armingWeight: double +Fighter(speed:double, armingWeight:double) +toString():String CivilAircraft -capacity: int +CivilAircraft(speed:double,capacity:int) +toString():String D. (20 pts] Implement the class Fleet that has as data an array of n aircrafts. a) Write the constructor, which creates an empty collection of Aircrafts. The size of this array is passed as a parameter to the constructor of the class Fleet b) Write the method addAircraft (A: Aircraft) which adds a CivilAircraft or a Fighter object to the collection. c) Write the method aircraftAt(ind: int) which returns the aircraft in the collection at the index ind if the index is valid. Otherwise, it should return null. d) Write the method fastestAircraft () which returns the aircraft with the max speed in the collection

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago