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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

[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.

Flight
«Abstract»
Person
|- people : ArrayList<Person>
+ loadPeopleFromDisk( fileName: String )
+ savePeopleToDisk( fileName: String )
+ checkCrew( )
+ addPerson( Person)
|- name : String
|- ID : int
+ Person( String, int )
Passenger
CrewMember
|- luggageWeight : double
+ setinfant( agelnMonths : int)
+ getinfantMonths(): int
|- recruited : Date
+ getType( ): CrewType
+ isSenior( ): boolean
CheckPilots
CheckHostesses
0.1
«Inner Class»
«Enum»
unchecked
See exam text
for details
Infant
CrewType
FlightException
FlightRules
|- agelnMonths : int
|- PILOT, COPILOT, HOSTESS
public class FlightRules {
public final static int minHostessCount = 2;
public final static int minSeniorHostessCount = 1;
public final static int years ToBecomeSenior = 3;
Transcribed Image Text:Flight «Abstract» Person |- people : ArrayList<Person> + loadPeopleFromDisk( fileName: String ) + savePeopleToDisk( fileName: String ) + checkCrew( ) + addPerson( Person) |- name : String |- ID : int + Person( String, int ) Passenger CrewMember |- luggageWeight : double + setinfant( agelnMonths : int) + getinfantMonths(): int |- recruited : Date + getType( ): CrewType + isSenior( ): boolean CheckPilots CheckHostesses 0.1 «Inner Class» «Enum» unchecked See exam text for details Infant CrewType FlightException FlightRules |- agelnMonths : int |- PILOT, COPILOT, HOSTESS public class FlightRules { public final static int minHostessCount = 2; public final static int minSeniorHostessCount = 1; public final static int years ToBecomeSenior = 3;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education