Now that you have the JAVA class source code to implement the PayStation application. Each class has been tested using the JUnit testing tool. Now youll put all the pieces together to complete a final product. In this lab assignment, you are required to develop a main program to demo to the clients how the product works.
A main() program should be developed to simulate the PayStation operation. It displays a menu to allow a customer to select a choice:
- Deposit Coins
- Buy Ticket
- Empty (Admin)
- Change Rate Strategy (Admin)
A maintenance worker may select the Admin menu options to empty the PayStation or Change Rate Strategy while the PayStation system is running. When Change Rate Strategy is chosen, a submenu will show different city names with their respective rate strategies.
The simulation software should show the following features:
- accept coins for payment.
- 5, 10, 25 cents
- show time bought on display.
- when a parking ticket is bought, prints a receipt with parking time.
- when a transaction is canceled, prints the returned coins values and number of each coin type.
- Implement rate strategies for five clients:
- Linear1 rate for Alphatown (5c buys two minutes)
- Progressive rate for Betatown (see below)
- Alternating1 rate for Gammatown (weekdays:progressive + weekend:linear1 ).
- Linear2 rate for Deltatown (5c buy 1 minute)
- Alternating2 rate for Omegatown (weekdays:linear1 + weekend:free).
- Rate strategy selections and changes can be done on the fly, i.e. at run-time. The default rate strategy is linear1 (Alphatown) rate.
- Alternating rate is a hybrid rate depending on the day of the week. Linear1 rate applies on weekends and progressive rate applies on weekdays.
- To get extra credit: account for weekend rollover (if a user enters coins at 11:30pm on Sunday, the first 30 minutes use linear rate, and any further coins use progressive rate). Dont worry about splitting coins (quarter entered at 11:55pm can give 10 minutes according to linear rate).
- Javas Calendar class provides a good starting point for this requirement.
- Calendars set() will be helpful for testing purposes.
- <em>/* <strong>Linear1 Rate Strategy</strong> */</em> time = (amount * 2) / 5; <em><strong>/* Progressive Rate Strategy */</strong> /* less than an hour (60 Min) so amount <150 */</em> time = (amount * 2) / 5; <em>/* between 1st hour and 2nd hour so 350>amount >=150 */</em> time = (amount – 150) * (3 / 10) + 60; <em>/* greater than 2 hours so amount >= 350 */</em> time = (amount – 350) / 5 + 120; <em>/* <strong>Alternating1</strong><strong> Rate Strategy</strong> */ /* On Weekdays Uses Progressive Rate */ /* On Weekends Uses Linear1 Rate Strategy */</em> <em>/* <strong>Linear2 Rate Strategy</strong> */</em> time = amount / 5; <em>/* <strong>Alternating2</strong><strong> Rate Strategy</strong> */ /* On Weekdays Uses Linear1 Rate */ /* On Weekends Free */ </em>
Part 2:PayStationMain main program and rate strategiesObjective:
- Draw a UML class diagram (Use any tool you prefer https://www.draw.io/ (Links to an external site.) is a free suggestion). Example for PayStationTDD UML Class Diagram (Links to an external site.).
What to submit?
- The first part of the Design Document with the Architecture
- A complete UML Class Diagram for the full project even if the code is not written yet. You will be allowed to update the diagram for the final submission.
- Do not forget to represent the Main() method so we can identify in which class it is located.