Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java programming please help.. java 2 waiting please.. C Get Homework Help With Chegg ~ | + 1URfavaSQej9vZD21ca TaBGyfNyevF7Ow/view Part I: Composition, Inheritance, Polymorphism, Abstract

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedjava programming

please help..

java 2

waiting please..

C Get Homework Help With Chegg ~ | + 1URfavaSQej9vZD21ca TaBGyfNyevF7Ow/view Part I: Composition, Inheritance, Polymorphism, Abstract Classes and Interfaces Question 1 [40 pts] Implement the below classes and interface as presented in the following UML diagram except the class Fighter for which you will find the code provided below. For all classes implement only the getters that you will need later in your code. > Comparable + compare Too:E).int 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 I 1 Fighter -arming Weight: double +Fighter(speed:double, armingWeightdouble) +toString():String CivilAircraft -capacity: int +CivilAircraft(speed double capacity.int ) | +toString(): String A. [6 pts] Write the abstract class Aircraft as presented in the above UML. a) Write the constructor. b) Write the toString() method. c) Write the abstract method allowedWeight(). B. Do not implement the class Fighter. The code is: C Get Homework Help With Chegg x + /1URfavaSQej9vZD21 ca TaBGyfNyevF7Ow/view Question 2 [20 points] Implement the driver class (application) as follows: a) Create a Fleet object, 2 fighters, and 3 civil aircrafts. Add the fighters and the civil aircrafts to the fleet. b) Write code to compare the civil aircrafts to display a message showing which one has the larger allowed weight c) Write code to find and display the fastest aircraft in the fleet. d) Ask the user to enter an index then display the aircraft in the fleet at this index otherwise display an error message. Page 3 of 5 Fall 2020 - 2021 3 5 CSCI300 Final Exam Page Part II: ArrayList and Inheritance [40 points] + ..d X Get Homework Help With Chegg + d/1URfavaSQej9vZD21ca TaBGyfNyevF7Ow/view Part II: ArrayList and Inheritance [40 points] Question 1 (20 points] Implement the class Vehicle only. The code of the classes Bicycle and Car is provided below. Vehicle #brand: String #model: String #price: double #checkin: ArrayList + Vehicle + Vehicle (--All parameters---) + addCheckInLocation (p: String) + removeCheckInLocation (p: String) + toString(): String Bicycle (Do not implement this class) Car gearCount :int + Bicycle --All parameters---) +toString(): String fuelType : String +Car(---All parameters----) + toString()String A. The Vehicle class is characterized by four data fields: a String brand, a String model, a double pri an array list of strings checkIn. Write the following methods: a) Two constructors (as shown in the UML). 11 c Get Homework Help With Chegg ~ | + 1URfavaSQej9vZD21ca Ta B GyfNyevF7Ow/view B. The Bicycle class inherits from the class Vehicle. The code is below: import java.util.ArrayList; public class Bicycle extends Vehicle { private int gearCount; public Bicycle (int gearCount, String brand, String model, double price, ArrayList checkIn) { super (brand, model, price, checkIn); this.gearCount = gearCount; } public String toString() { return super.toString() + ", the gear count is + gearCount; } T! } C. The Car class inherits from the class Vehicle. The code is below: import java.util.ArrayList; public class car extends Vehicle { private String fuelType; public Car (String fuelType, String brand, String model, double price, ArrayList checkin) { super (brand, model, price, checkIn); this. fuelType = fuelType; } public String toString() { return super.toString() + ", the fuel type is Fuel Type; } 11 - } Question 2 [20 points] Write a client class (application) in Pageh yu: 1 5 + Get Homework Help With Chegg x + URfavaSQej9vZD21ca TaBGyfNyevF7Ow/view this. Eueltype = fueltype; } public String tostring() { return super.toString() + } } ", the fuel type is Fuel Type; Question 2 [20 points] Write a client class (application) in which you: a) Define an array (not an ArrayList) of 7 Vehicles, and fill it with 4 Cars and 3 Bicycles objects using values assigned by the programmer. Do not ask the user to enter the values. b) Write a static method ArrayListgetLocations(Vehicle[ ] vehicles, String location) that takes as parameter an array of vehicles and a String "location. This method returns an array list containing the cars in the array vehicles) checked in the "location. c) In the main method, use the getLocations method to display the cars checked in Beirut. d) Display the information of the most expensive vehicle (the vehicle with the biggest price). Page 5 of 5 Page 5 1 5 +

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago

Question

6. What data will she need?

Answered: 1 week ago

Question

1. How did you go about making your selection?

Answered: 1 week ago