diff options
Diffstat (limited to '')
-rw-r--r-- | sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java index 68bf25a8cd..09e5d322a3 100644 --- a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java +++ b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java @@ -18,11 +18,22 @@ */
package com.tuscanyscatours;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
public class ShoppingCart implements Checkout, Updates {
- public void makePayment(double amount, String cardInfo) {
- // make payment for trips in cart giving card details
+ private static List<String> bookedTrips = new ArrayList<String>();
+
+ public void makePayment(BigDecimal amount, String cardInfo) {
+ System.out.print("Charged $" + amount + " to card " + cardInfo + " for trips" );
+ for (String trip : bookedTrips){
+ System.out.print(" " + trip);
+ }
+ System.out.println();
+ bookedTrips.clear();
}
public void addTrip(String resCode) {
- // add the booked trip to the cart
+ bookedTrips.add(resCode);
}
}
|