Programming Task (100 marks) Given the UML diagram below implement the code in NetBeans. Ticket -id:int...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Programming Task (100 marks) Given the UML diagram below implement the code in NetBeans. Ticket -id:int -price: int -startTime:int -endTime:int -departure:String -destination: String -nrOfStops:int -availableQuantity:int +Ticket() +Ticket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int) Train Ticket +toString(): String +calc():int -cabinNr:int -soldTickets:int +TrainTicket() +TrainTicket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int, cabin Nr:int,soldTickets:int) +toString():String +calc(): int -Method calc() is abstract. 4 Plane Ticket -nrOfLuggage:int -changeTicket: boolean Create abstract class Ticket, and classes TrainTicket and Plane Ticket. Define all attributes and implement all necessary getters and setters for Ticket, TrainTicket and Plane Ticket. Implement the methods in class Ticket with the following specifications: +Plane Ticket() +Plane Ticket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int, nrOfLuggage:int, waitingTime: int) +toString():String +add LuggageToPrice(): int +calc():int -Method toString() will return a string with all the information about the ticket, as in the example below: "Ticket 1558 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. In total available tickets 120." Implement the methods in class TrainTicket with the following specifications: -Method calc() will calculate and return the profit made from the sold tickets. (profit = price* soldTickets) -Method toString() will return a string with all the information about the TrainTicket as in the example below: "Ticket 1234 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. In total available tickets 120 for 60 cabins, and 23 tickets are sold." if any ticket has been sold, or "Ticket 1234 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. All tickets for 60 cabins are still available" if no ticket has been sold yet. Implement the methods in class Plane Ticket with the following specifications: -Method toString() will return a string with all the information about the Plane Ticket as in the example below: "Ticket 1234 from Kuwait to Rome leaves at 9, arrives at 18, stops 2 times costs 150 KD; in total 3Pieces of luggage are booked." -Method calc() will calculate and return the final price of the plane ticket. If the value of the textfield changeTicket is no, then the final price is the sum of the ticket price and the number of luggage multiplied by 15, if the value of changeTicket is yes, then the final price is the sum of the ticket price+20, and the number of luggage multiplied by 15. Write as a comment in the beginning of your code, your section, and your name &ids. Submit your project in zip or rar format in moodle, your section's page. 2 Programming Task (100 marks) Given the UML diagram below implement the code in NetBeans. Ticket -id:int -price: int -startTime:int -endTime:int -departure:String -destination: String -nrOfStops:int -availableQuantity:int +Ticket() +Ticket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int) Train Ticket +toString(): String +calc():int -cabinNr:int -soldTickets:int +TrainTicket() +TrainTicket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int, cabin Nr:int,soldTickets:int) +toString():String +calc(): int -Method calc() is abstract. 4 Plane Ticket -nrOfLuggage:int -changeTicket: boolean Create abstract class Ticket, and classes TrainTicket and Plane Ticket. Define all attributes and implement all necessary getters and setters for Ticket, TrainTicket and Plane Ticket. Implement the methods in class Ticket with the following specifications: +Plane Ticket() +Plane Ticket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int, nrOfLuggage:int, waitingTime: int) +toString():String +add LuggageToPrice(): int +calc():int -Method toString() will return a string with all the information about the ticket, as in the example below: "Ticket 1558 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. In total available tickets 120." Implement the methods in class TrainTicket with the following specifications: -Method calc() will calculate and return the profit made from the sold tickets. (profit = price* soldTickets) -Method toString() will return a string with all the information about the TrainTicket as in the example below: "Ticket 1234 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. In total available tickets 120 for 60 cabins, and 23 tickets are sold." if any ticket has been sold, or "Ticket 1234 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. All tickets for 60 cabins are still available" if no ticket has been sold yet. Implement the methods in class Plane Ticket with the following specifications: -Method toString() will return a string with all the information about the Plane Ticket as in the example below: "Ticket 1234 from Kuwait to Rome leaves at 9, arrives at 18, stops 2 times costs 150 KD; in total 3Pieces of luggage are booked." -Method calc() will calculate and return the final price of the plane ticket. If the value of the textfield changeTicket is no, then the final price is the sum of the ticket price and the number of luggage multiplied by 15, if the value of changeTicket is yes, then the final price is the sum of the ticket price+20, and the number of luggage multiplied by 15. Write as a comment in the beginning of your code, your section, and your name &ids. Submit your project in zip or rar format in moodle, your section's page. 2 Programming Task (100 marks) Given the UML diagram below implement the code in NetBeans. Ticket -id:int -price: int -startTime:int -endTime:int -departure:String -destination: String -nrOfStops:int -availableQuantity:int +Ticket() +Ticket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int) Train Ticket +toString(): String +calc():int -cabinNr:int -soldTickets:int +TrainTicket() +TrainTicket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int, cabin Nr:int,soldTickets:int) +toString():String +calc(): int -Method calc() is abstract. 4 Plane Ticket -nrOfLuggage:int -changeTicket: boolean Create abstract class Ticket, and classes TrainTicket and Plane Ticket. Define all attributes and implement all necessary getters and setters for Ticket, TrainTicket and Plane Ticket. Implement the methods in class Ticket with the following specifications: +Plane Ticket() +Plane Ticket(id:int, price:int,startTime:int, endTime:int,dep:String, dest:String, nrOfStops:int, availableQuantity:int, nrOfLuggage:int, waitingTime: int) +toString():String +add LuggageToPrice(): int +calc():int -Method toString() will return a string with all the information about the ticket, as in the example below: "Ticket 1558 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. In total available tickets 120." Implement the methods in class TrainTicket with the following specifications: -Method calc() will calculate and return the profit made from the sold tickets. (profit = price* soldTickets) -Method toString() will return a string with all the information about the TrainTicket as in the example below: "Ticket 1234 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. In total available tickets 120 for 60 cabins, and 23 tickets are sold." if any ticket has been sold, or "Ticket 1234 from Egaila to Salmiya leaves at 9, arrives at 10, stops 5 times costs 1 KD. All tickets for 60 cabins are still available" if no ticket has been sold yet. Implement the methods in class Plane Ticket with the following specifications: -Method toString() will return a string with all the information about the Plane Ticket as in the example below: "Ticket 1234 from Kuwait to Rome leaves at 9, arrives at 18, stops 2 times costs 150 KD; in total 3Pieces of luggage are booked." -Method calc() will calculate and return the final price of the plane ticket. If the value of the textfield changeTicket is no, then the final price is the sum of the ticket price and the number of luggage multiplied by 15, if the value of changeTicket is yes, then the final price is the sum of the ticket price+20, and the number of luggage multiplied by 15. Write as a comment in the beginning of your code, your section, and your name &ids. Submit your project in zip or rar format in moodle, your section's page. 2
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
How does MC1R Protein Synthesize?
-
The following table depicts the number of grapes that can be picked in an hour with varying amounts of labor: Number of pickers (per hour) ...................... 1....2.... 3.... 4 ....5 ....6...
-
In Exercises confirm that the Integral Test can be applied to the series. Then use the Integral Test to determine the convergence or divergence of the series. n=1 1 n+ 3
-
Diageo North America, Inc., the owner of the Bulleit brand family of whiskeys, sued competitor W.J. Deutsch & Sons Ltd. for allegedly infringing upon the trade dress of Diageos Bulleit bottles....
-
1. Toula and Ian Miller of Lincoln, Nebraska, recently suffered a fire in their home. The fire, which began in a crawl space at the back of the house, caused $24,000 of damage to the dwelling. The...
-
An 76 kg man starts from rest and after 1.60 seconds is running at a speed of 11.0 m/s. The force needed for this man to get up to this speed in 1.60 seconds is ____ N.
-
Mahjong, Inc., has identified the following two mutually exclusive projects: Year ______Cash Flow (A) ________Cash Flow (B) 0 ................. -$43,000 ................... -$43,000 1...
-
At the end of the current year, Accounts Receivable has a balance of $820,000; The provision for doubtful accounts has a credit balance of $7,500; and sales for the year total $3,690,000. Bad debt...
-
Summary of the article: The Role Of The Family In The Socialization Of Children. By BaferanI, M.H. The main purpose of this research is to study "the role of the family in the socialization of...
-
Breckinridger Corp. has a debt-equity ratio of .80. The company is considering a new plant that will cost $115 million to build. When the company issues new equity, it incurs a flotation cost of 8.5...
-
What is the real interest rate if the nominal interest rate is still 8% but inflation is 1%? Does it cost more or less to borrow than when inflation was 3%?
-
How is the portfolio beta affected by the correlation coefficients of the stocks in the portfolio? Explain
-
Audit evidence is a key component of an external audit. In the absence of audit evidence, the entire audit process becomes unreliable. Auditors place great emphasis on the collection, collation, and...
-
Solve the partial differential differential by separation of variables 3 + 7 = 0. = 0.
-
Multiple Choice Questions: 1. The largest component of aggregate demand is? a. Government purchases. b. Net exports. c. Consumption. d. Investment. 2. A reduction in personal income taxes, other...
-
In each of the following cases involving taxes, explain: (i) Whether the incidence of the tax falls more heavily on consumers or producers. (ii) Why government revenue raised from the tax is not a...
-
The city of Falls Church, Virginia, subsidizes trees planted in homeowners' front yards when they are within 15 feet of the street. a. Using concepts in the chapter, explain why a municipality would...
-
You have been hired as a consultant by a company to develop the company's retirement plan, taking into account different types of predictably irrational behavior commonly displayed by employees....
-
Santinis new contract for 2019 indicates the following compensation and benefits: Santini is 54 years old at the end of 2019. He is single and has no dependents. Assume that the employer matches $1...
-
In 2019, Nina contributes 10 percent of her $100,000 annual salary to her 401(k) account. She expects to earn a 7 percent before-tax rate of return. Assuming she leaves this (and any employer...
-
In 2019, Nitai (age 40) contributes 10 percent of his $100,000 annual salary to a Roth 401(k) account sponsored by his employer, AY Inc. AY Inc. matches employee contributions to the employees...
Study smarter with the SolutionInn App