Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SYSTEMS ANALYSIS AND DESIGN In the figure below you see a fragment of class diagram that represents parking tickets. Tickets have a state (mostly depending

SYSTEMS ANALYSIS AND DESIGN

In the figure below you see a fragment of class diagram that represents parking tickets. Tickets have a state (mostly depending on how long they have been waiting, but the details are not relevant here) represented by the hierarchy in the figure; the operation calculateCharge(), which is abstract in the parent class, is overridden in the child classes because its behaviour depends on the state of the ticket (and obviously on the specific child class).

  1. Briefly explain why the solution in the figure above is not a good one.
  2. Draw a (fragment of) class diagram that represents parking tickets and their states by means of the State pattern, with the overriding of calculateCharge() according to the state. [Note: you are not required to detail the classes; names, association(s), inheritance and the single operation calculateCharge() will be sufficient.]

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

More Books

Students also viewed these Databases questions