Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

just for java Airline class The constructor in the Airline class sets name, initializes the totalPlanes to 0, and initializes the array to hold. 10

just for javaimage text in transcribed

Airline class The constructor in the Airline class sets name, initializes the totalPlanes to 0, and initializes the array to hold. 10 planes. The Airline toString method returns the name of the Airline, total number of planes, and the total number of passengers that have flown on all their planes. The addPlane method adds a plane object to the array of Planes that the Airline has percentageFull returns numberOfAllPassengersumberOfAllSeats in the Planes in the airline to see how full all the planes are Plane class The constructor sets the name of the plane (flight name), the total number of seats on the plane and sets numPassengers to 0 addPassenger method increases the numPassengers by the number num (do appropriate checks in this method) hasMoreSeats (Plane p) compares two Plane objects (this Plane and Plane p) to see which one has more seats on the plane(ie., see which one is bigger). Properly test your classes by performing the following operations in a demo class, at minimum. Create an Airline class with at least 3 Plane objects. Add passengers to all the Planes. Add the planes to your airline. Print out the totalNumber of planes that the airline has. Print out the total number of passengers on all the Planes. (use the method getTotalPassengers in the Airline class). Add some more passengers to your second plane. Print out the percentageFull (totalPassengers from all planes/totalSeats from all planes) on all the Planes. Print out the plane object that has the most seats. Call the toString method in the Airline Class

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions