Question: 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] __________________________________________________________________

 Answer the following question? Consider the class diagram provided in Figure

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!