PayStation Main Design Document Paper & Code

User Generated

wbyva123456

Programming

Description

Part 1:Coding

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 you’ll 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
  • Display
  • Buy Ticket
  • Cancel
  • 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).  Don’t worry about splitting coins (quarter entered at 11:55pm can give 10 minutes according to linear rate).
    • Java’s Calendar class provides a good starting point for this requirement.
    • Calendar’s set() will be helpful for testing purposes.
    • Summary:
    • <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:

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. 

Unformatted Attachment Preview

PayStation Main Design Document CIS 3296 Section 0x Spring 2022 Team Members: Repository URL: - 1 | Page 9/6/2022 Table of Contents Document Overview ................................................................................................................................. 3 Architecture .............................................................................................................................................. 3 API ............................................................................................................................................................ 3 Package edu.temple.cis.paystation ........................................................................................................ 4 Class IllegalCoinException ................................................................................................................... 5 Interface PayStation .............................................................................................................................. 7 Class PayStationImpl .......................................................................................................................... 10 Interface Receipt ................................................................................................................................. 15 Class ReceiptImpl ............................................................................................................................... 16 2 | Page 9/6/2022 Document Overview This Design Document describes the software architecture and how the requirements are mapped into the design. This document will be a combination of diagrams and text that is describing what the diagrams are showing. The Design Document also specify the complete design of the software implementation using Javadoc. Architecture This section describes the different components and their interfaces using UML. For example: client, server, database. For each component provide class diagrams showing the classes to be developed (or used) and their relationship. Figure 1 UML Example Class Diagram for PayStation TDD Detail Design API For each class define the data fields, methods. • The purpose of the class. • The purpose of each data field. • The purpose of each method • Pre-conditions if any. • Post-conditions if any. • Parameters and data types • Return value and output variables • Exceptions thrown*. This information should be in structured comments (e.g. Javadoc) in the source files. A documentation generation tool (e.g. Javadoc) may be used to generate the document as a draft. 3 | Page 9/6/2022 Package edu.temple.cis.paystation package edu.temple.cis.paystation All Classes and Interfaces Interfaces Class Description Classes Exceptions IllegalCoinException PayStation PayStationImpl Implementation of the pay station. Receipt ReceiptImpl 4 | Page 9/6/2022 Class IllegalCoinException java.lang.Object java.lang.Throwable java.lang.Exception edu.temple.cis.paystation.IllegalCoinException All Implemented Interfaces: Serializabl public class IllegalCoinException extends Exceptio n e See Also: Serialized Form Constructor Summary Constructors Constructor Description IllegalCoinException(String e) Method Summary Methods inherited from class java.lang.Throwable addSuppressed , fillInStackTrace , getCause , getLocalizedMessage , getMessage , getStackTrace , getSuppressed , initCause , printStackTrace , printStackTrace , printStackTrace , setStackTrace , toString Methods inherited from class java.lang.Object clone , equals wait , wait , finalize , getClass , hashCode , notify , notifyAll , wait , Constructor Details 5 | Page 9/6/2022 IllegalCoinException public IllegalCoinException (Strin g 6 | Page e) 9/6/2022 Interface PayStation All Known Implementing Classes: PayStationImpl public interface PayStation Method Summary All Methods Instance Methods Modifier and Type Abstract Methods Method Description void addPayment(int coinValue) Insert coin into the pay station and adjust state accordingly. Receipt buy() Map Buy parking time. cancel()Cancel the present money int collected. empty()Reset int machine's display. readDisplay()Read the 7 | Page 9/6/2022 Method Details addPayment void addPayment (int coinValue ) throws IllegalCoinException Insert coin into the pay station and adjust state accordingly. Parameters: coinValue - is an integer value representing the coin in cent. That is, a quarter is coinValue=25, etc. Throws: IllegalCoinException - in case coinValue is not a valid coin value readDisplay int readDisplay() Read the machine's display. The display shows a numerical description of the amount of parking time accumulated so far based on inserted payment. Returns: the number to display on the pay station display 8 | Page 9/6/2022 buy Receipt buy() Buy parking time. Terminate the ongoing transaction and return a parking receipt. A non-null object is always returned. Returns: a valid parking receipt object. cancel Map cancel() Cancel the present transaction. Resets the paystation for a new transaction. Returns: A Map defining the coins returned to the user. The key is the coin type and the associated value is the number of these coins that are returned. The Map object is never null even if no coins are returned. The Map will only contain only keys for coins to be returned. The Map will be cleared after a cancel or buy. empty int empty() Reset money collected. Sets the amount of money collected by the machine since the last call to 0. Returns: total amount of money collected by the machine since last call. 9 | Page 9/6/2022 Class PayStationImpl java.lang.Object edu.temple.cis.paystation.PayStationImpl All Implemented Interfaces: PayStation public class PayStationImpl extends Objec t implements PayStation Implementation of the pay station. Responsibilities: 1) Accept payment; 2) Calculate parking time based on payment; 3) Know earning, parking time bought; 4) Issue receipts; 5) Handle buy and cancel events. This source code is from the book "Flexible, Reliable Software: Using Patterns and Agile Development" published 2010 by CRC Press. Author: Henrik B Christensen Computer Science Department Aarhus University This source code is provided WITHOUT ANY WARRANTY either expressed or implied. You may study, use, modify, and distribute it for non-commercial purposes. For any commercial use, see http://www.baerbak.com/ Constructor Summary Constructors Constructor Description PayStationImpl() Method Summary All Methods Instance Methods Modifier and Type void Map 10 | Page Description addPayment(int coinValue) Insert coin into the pay station and adjust state accordingly. Receipt int Method Concrete Methods buy() cancel() empty() Buy parking time. Cancel the present transaction. Reset money collected. 9/6/2022 int readDisplay() Read the machine's display. Methods inherited from class java.lang.Object clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait Constructor Details PayStationImpl public PayStationImpl () Method Details addPayment public void addPayment(int throws IllegalCoinException coinValue) Description copied from interface: PayStation Insert coin into the pay station and adjust state accordingly. Specified by: addPayment in interface PayStation Parameters: coinValue - is an integer value representing the coin in cent. That is, a quarter is coinValue=25, etc. Throws: IllegalCoinException - in case coinValue is not a valid coin value 11 | Page 9/6/2022 readDisplay public int readDisplay() Description copied from interface: PayStation Read the machine's display. The display shows a numerical description of the amount of parking time accumulated so far based on inserted payment. Specified by: 12 | Page 9/6/2022 readDisplay in interface PayStation Returns: the number to display on the pay station display buy public Receipt buy() Description copied from interface: PayStation Buy parking time. Terminate the ongoing transaction and return a parking receipt. A non-null object is always returned. Specified by: buy in interface PayStation Returns: a valid parking receipt object. cancel public Map cancel() Description copied from interface: PayStation Cancel the present transaction. Resets the paystation for a new transaction. Specified by: cancel in interface PayStation Returns: A Map defining the coins returned to the user. The key is the coin type and the associated value is the number of these coins that are returned. The Map object is never null even if no coins are returned. The Map will only contain only keys for coins to be returned. The Map will be cleared after a cancel or buy. empty 13 | Page 9/6/2022 public int empty() Description copied from interface: PayStation Reset money collected. Sets the amount of money collected by the machine since the last call to 0. Specified by: empty in interface PayStation Returns: total amount of money collected by the machine since last call. 14 | Page 9/6/2022 Package edu.temple.cis.paystation Interface Receipt All Known Implementing Classes: ReceiptImpl public interface Receipt Method Summary All Methods Instance Methods Modifier and Type Method Abstract Methods Description value() Return the number of minutes this receipt is valid for. int Method Details value int value () Return the number of minutes this receipt is valid for. Returns: number of minutes parking time 15 | Page 9/6/2022 Package edu.temple.cis.paystation Class ReceiptImpl java.lang.Object edu.temple.cis.paystation.ReceiptImpl All Implemented Interfaces: Receipt public class ReceiptImpl extends Objec t implements Receipt Constructor Summary Constructors Constructor Description ReceiptImpl(int value) Method Summary All Methods Instance Methods Modifier and Type Method Concrete Methods Description value() Return the number of minutes this receipt is valid for. int Methods inherited from class java.lang.Object clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait 16 | Page 9/6/2022 Constructor Details ReceiptImpl public ReceiptImpl (int value ) Method Details value public int value () Description copied from interface: Receipt Return the number of minutes this receipt is valid for. Specified by: value in interface Receipt Returns: number of minutes parking time 17 | Page 9/6/2022
Purchase answer to see full attachment
Explanation & Answer:
1 Paper
1 Diagram
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and answer. Let me know if you have any questions.Hello,the zip contains the code. You will also find javadoc html files, an UML file realized with the objectaid software and a document called documentation.rtf with description of classes and methods realized with javadoc and the rtf doclet.You can test the software using your IDE or by running the class with the main method (PayStationImpl).The design document is instead the report realized according to specifications, with description of classes and methods and with explanation of design choices as well.Let me know if everything is alright.

PayStation Main
Design Document
CIS 3296 Section 0x
Spring 2022

Team Members:
Repository URL:
-

1 | Page

1/22/2022

Table of Contents
Document Overview

3

Architecture

3

Detail Design API
Package edu.temple.cis.paystation
public class Linear2RateStrategy implements RateStrategy
public interface PayStation
public class Alternating2RateStrategy extends AlternatingRateStrategy
public class Linear1RateStrategy implements RateStrategy
public class AlternatingRateStrategy implements RateStrategy
public class IllegalCoinException extends java.lang.Exception
public interface Receipt
public class ReceiptImpl implements Receipt
public class ProgressiveRateStrategy implements RateStrategy
public class FreeRateStrategy implements RateStrategy
public class PayStationImpl implements PayStation
public interface RateStrategy
public class Alternating1RateStrategy extends AlternatingRateStrategy

4
4
4
4
5
5
5
6
6
6
6
7
7
8
8

2 | Page

1/22/2022

Document Overview
This Design Document describes the software architecture and how the requirements are mapped into the
design. This document is a combination of diagrams and text that is describing what the diagrams are
showing. The first section is Architecture and shows the classes UML diagram, along with an explanation
of the design and design choices. The second section is Detail Design API and specifies classes and methods
using a Javadoc format.

Architecture
This section describes the different components and their interfaces using UML. This diagram shows the
classes to be developed (or used) and their relationship. Every class and interface represented in the diagram
is part of the same package.

Figure 1 UML Class...


Anonymous
Excellent resource! Really helped me get the gist of things.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Related Tags