eSenior = 3; } Answer these questions according to the UML class schema and the code given above. You may need to extract hidden information from the schema and add necessary code while answering the questions. Question 1: Write the source code of the class Passenger. A passenger can travel with an infant (i.e. his/her child). Code the class Infant as an inner class of the class Passenger. If a passenger is not travelling with an infant, the getInfantMonths method must return –1. Question 2: Write the source code of the exception FlightException. Question 3: Write the source code of the m
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
[JAVA]
public class FlightRules {
public final static int minHostessCount = 2;
public final static int minSeniorHostessCount = 1;
public final static int yearsToBecomeSenior = 3;
}
Answer these questions according to the UML class schema and the code given above. You may need to extract hidden information from the schema and add necessary code while answering the questions.
Question 1: Write the source code of the class Passenger. A passenger can travel with an infant (i.e. his/her child). Code the class Infant as an inner class of the class Passenger. If a passenger is not travelling with an infant, the getInfantMonths method must return –1.
Question 2: Write the source code of the exception FlightException.
Question 3: Write the source code of the multithreaded class of CheckPilots. The details of this class is given in Question 6 as an instance of this class is used in the Flight.checkCrew() method.
Question 4: Write the source code of the class Flight. Some details of this class is as follows:
addPerson: This method creates a FlightException if a person with the same ID is attempted to add to the people list multiple times.
checkCrew: This method is responsible from creating an instance of CheckHostesses and an instance of CheckPilots in separate threads and from executing them. The CheckHostesses instance checks the people list for hostesses. A flight must contain at least two hostesses and at least one of them must be senior worker. The CheckPilots instance checks the people list for pilots because a flight must contain a pilot and a copilot.
loadPeopleFromDisk and savePeopleToDisk: If a crew checking operation is in progress, those methods must wait for the end of that checking operation.
Step by step
Solved in 2 steps