Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following question? Consider the class diagram provided in Figure 1. Name one method that is over-ridden in the EconomyTicket class. [1 mark] __________________________________________________________________

image text in transcribed

Answer the following question?

  1. Consider the class diagram provided in Figure 1. Name one method that is over-ridden in the EconomyTicket class. [1 mark]

__________________________________________________________________

  1. What does it mean to over-ride a method in java? [2 marks]
  2. This question relates to the UML diagram provided in Figure 1.

  3. Given the following 2 lines of code:
  4. 1 TrainService ts = new TrainService(ByronBay, Central, 10:00);
  5. concessionTkType = new TicketType(TicketType.CONCESSION);
  6. State whether the following lines of code are valid or not: [3 x 1 marks]
  7. Ticket tk = new Ticket(ts, concessionTkType);
  8. ANS ____________________________________________________
  9. FIrstClassTicket fct = new FirstClassTicket(ts, concessionTkType);
  10. ANS ____________________________________________________
  11. FirstClassTicket fctik = new Ticket(tk, concessionTkType);
  12. ANS ____________________________________________________

  13. For each of the above lines of code give a reason for why they are/are not valid [3 x 1 marks]
  14. ANS
Ticket date Expiry: Date datelssued: Date service: Train Service ticketPrice: double ticketType: TicketType + getService(): TrainService + getTicketPrice(): double + issue Concession Ticket(): double + issue FullPrice Ticket(): double + issue Ticket(): double + print(): void setService (TrainService): void setTicketTypeTicketType): void + Ticket(TrainService, TicketType) + toString(): String Economy ClassTicket Economy ClassTicket(Train Service, TicketTyp + getTicketPrice(): double + toString(): String FirstClassTicket seatNumber: String SURCHARGE: double = 0.25 travelDate: Date + FirstClassTicket(TrainService, TicketType, Date + getTicketPrice(): double setSeatNumber(String): void setTravelDate(Date): void + toString(): String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

=+ d. Income per worker in Richland is actually

Answered: 1 week ago