Question: private String sType; private String sStatus; private int numS; public Seat(String type, String status, int num) { seatType = type; seatStatus = status; //here I
private String sType;
private String sStatus;
private int numS;
public Seat(String type, String status, int num) {
seatType = type;
seatStatus = status; //here I should say the seat status is empty, not completely sure how can I do that.
numSeat = num; }
public String getSeatType() {
return seatT; }
public int getSeatNum() {
return numS; }
public String getSeatStatus() {
return seatS; }
public String toString()
{
String str = new String();
str+= numS + ", type " +seatT + ", is " + seatS; return str; }
}
In Java I need to create a class named airplane class, below are the specifications: Airplane Class: An instance of the Airplane class should store a reference to an array which stores references to seats on the plane and the number of seats in first class. The Airplane class should provide the following behaviors: A parameterized constructor that creates the array based upon the number of seats passed to it and populate the array with seats. All planes have a maximum of 40% of their seats designated as first class and the remaining 60% as coach class. For example, in a plane with 10 seats, there are 4 first class seats (at the front of the plane) and 6 coach class seats (after the end of the first class). If there isnt an even split, the plane will have slightly less than 40% first class and slightly more than 60% coach class. For example, in a plane with 14 seats, 40% would be 5.6 seats. In order to avoid going over the 40% maximum, this plane would have 5 first class seats and 9 coach class seats.
A method to determine and return the current capacity (ie. the percent of occupied seats) of a class of seat (first or coach). A method to assign a first class or coach class seat. As long as the class of seat requested is less than 50% capacity, the reservation can be completed. Since the airline wants to keeps its passengers as socially distant as possible you will have to come up with a strategy to assign seats in such a way that passengers are spaced out within their class of service. Each row in the plane only has 1 seat.
A method to cancel a specific previously reserved first class or coach class seat.
**can you please help with those methods?
**I have an idea of how to do the parameterized constructor but i am confuse on how to create the seats.
Thank you so much
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
