Print the arrival time of the flight using a combination of methods from Flight and LocalTime • Read and delay the flight by N minutes • Print the flight object to the console again You don't have access to the code from Flight or LocalTime. You don't need to implement these classesi Example Output Flight #1324 is scheduled to depart at 10:30. Duration 2.00 hours The plane will arrive Flight #1324 is scheduled to depart at 11.30. Duration 2.00 hours Flight #1324 is scheduled to depart at 10:30. Duration 2.00 hours The plane will arrive at 12.30 Flight #1324 is scheduled to depart at 10.30. Duration 2.00 hours Input 1324 10 30 120 60 12.30 1324 10 30 120 0

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java.

Refer to Screenshot.

3. Problem 2 - Creating and Using Objects
Saved
• Print the arrival time of the flight using a combination of methods from Flight and LocalTime
• Read and delay the flight by N minutes
• Print the flight object to the console again
You don't have access to the code from Flight or LocalTime. You don't need to implement these classes!
Example
Output
Flight #1324 is scheduled to depart at 10:30.
Duration 2.00 hours
The plane will arrive at 12.30
Fight
Input
1324 10 30 120 60
#1324 is scheduled to depart at 11:30.
Duration 2.00
Flight #1324 is scheduled to depart at 10:30.
Duration 2.00 hours
The plane will arrive at 12.30
Flight #1324 is cheduled to depart at 10.30.
Duration 2.00 hours
hours
1324 10 30 120 0
Transcribed Image Text:3. Problem 2 - Creating and Using Objects Saved • Print the arrival time of the flight using a combination of methods from Flight and LocalTime • Read and delay the flight by N minutes • Print the flight object to the console again You don't have access to the code from Flight or LocalTime. You don't need to implement these classes! Example Output Flight #1324 is scheduled to depart at 10:30. Duration 2.00 hours The plane will arrive at 12.30 Fight Input 1324 10 30 120 60 #1324 is scheduled to depart at 11:30. Duration 2.00 Flight #1324 is scheduled to depart at 10:30. Duration 2.00 hours The plane will arrive at 12.30 Flight #1324 is cheduled to depart at 10.30. Duration 2.00 hours hours 1324 10 30 120 0
In this problem, you will practice creating and manipulating objects. You will create an object from the Flight class.
The Flight class depends on the LocalTime class since it is used as the variable type for the departure time instance variable in Flight. You need to pass a LocalTime variable to Flight's constructor.
You can create new LocalTime variables and initialize them using LocalTime's of method. This method is STATIC. Example
//Creates a new LocalTime variable and initializea it to 12 (24h format)
LocalTime lunchTime = LocalTime.of (12,30) ;
The plus and minus methods are instance methods and can be used to get a new LocalTIime offset by hours, minutes or another LocalTIme variable. LocalTime has other methods not depicted here which are not required for this practicum.
Flight
Local Time
|- flightNumber : int
|- departure Time : LocalTime
flightDurationInMinutes: int
- isDelayed : boolean
+ ofint hour, int minute) : LocalTime
+ ofint hour,int minute, int second) : LocalTime
+ plus(LocalTime) : LocalTime
+ plusHours(int): LocalTime
+ plusMinutes(int) : LocalTime
+ minus(LocalTime) : LocalTime
+ minusMinutes(int) : LocalTime
+ minusHours(int) : LocalTime
+ toString() : String
+ Flight(int flightNumber, LocalTime departure Time, int flightDurationInMinutes)
+ getFlightNumber() : int
+ getDeparture Time() : LocalTime
+ getFlightDurationInMinutes(): int
+ isFlightDelayed() : boolean
+ delayFlight(int): LocalTime
+ toString() : String
Your task in this problem is to:
• read from the user a flight number, departure hour and minute, and flight duration in minutes (all ints)
o Aiready implemented in the starter code
• Create a new Flight object
• Print the object to the console
• Print the arrival time of the flight using a combination of methods from Flight and LocalITime
• Read and delay the flight by N minutes
• Print the flight object to the console again
Transcribed Image Text:In this problem, you will practice creating and manipulating objects. You will create an object from the Flight class. The Flight class depends on the LocalTime class since it is used as the variable type for the departure time instance variable in Flight. You need to pass a LocalTime variable to Flight's constructor. You can create new LocalTime variables and initialize them using LocalTime's of method. This method is STATIC. Example //Creates a new LocalTime variable and initializea it to 12 (24h format) LocalTime lunchTime = LocalTime.of (12,30) ; The plus and minus methods are instance methods and can be used to get a new LocalTIime offset by hours, minutes or another LocalTIme variable. LocalTime has other methods not depicted here which are not required for this practicum. Flight Local Time |- flightNumber : int |- departure Time : LocalTime flightDurationInMinutes: int - isDelayed : boolean + ofint hour, int minute) : LocalTime + ofint hour,int minute, int second) : LocalTime + plus(LocalTime) : LocalTime + plusHours(int): LocalTime + plusMinutes(int) : LocalTime + minus(LocalTime) : LocalTime + minusMinutes(int) : LocalTime + minusHours(int) : LocalTime + toString() : String + Flight(int flightNumber, LocalTime departure Time, int flightDurationInMinutes) + getFlightNumber() : int + getDeparture Time() : LocalTime + getFlightDurationInMinutes(): int + isFlightDelayed() : boolean + delayFlight(int): LocalTime + toString() : String Your task in this problem is to: • read from the user a flight number, departure hour and minute, and flight duration in minutes (all ints) o Aiready implemented in the starter code • Create a new Flight object • Print the object to the console • Print the arrival time of the flight using a combination of methods from Flight and LocalITime • Read and delay the flight by N minutes • Print the flight object to the console again
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY