A stubbed version[1]of Receipt has been added to the Store Simulator code base.
First, run the tests. You will see that one of the tests is already passing with the stubbed Receipt code but look at the test output: it indicates that the receipt printing feature is not yet implemented.
Now you will complete the Receipt methods (by replacing the stubbed version with your implementation from Part 2) and test the integration by running the tests again. The output of test 2 will be the same as in Assignment 3, except that the receipt will be printed when a Customer is served, as in the sample below:
SelfServe (ID 1) served Customer (ID 1) with 5 items
Item Unit Qty Price
– –
Bic Pen (Blu 0.99 1 0.99
Bic Pen (Red 0.99 1 0.99
Bic Pen (Spa 2.99 3 8.97
Total 10.95
Checkout (ID 2) served Customer (ID 6) with 5 items
Item Unit Qty Price
– –
Bic Pen (Blu 0.99 1 0.99
Bic Pen (Bla 0.99 2 1.98
Bic Pen (Spa 2.99 2 5.98
Total 8.95
SelfServe (ID 3) served SelfServeCustomer (ID 43) with 1 items
Item Unit Qty Price
– –
Bic Pen (Red 0.99 1 0.99
Total 0.99
[1]A stubbed class contains all public methods, however these methods are empty. Methods that require a return value return a dummy value (for example, null if the return type is an object, 0 if a numeric data type, etc.).
.Class Receipt.java
public class Receipt {
public Receipt () { }
public void add (ProductInfo pInfo) { }
public String getPrintedReceipt () { return RECEIPT FEATURE INCOMPLETE; }
}
Reviews
There are no reviews yet.