summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java4
-rw-r--r--sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java17
2 files changed, 17 insertions, 4 deletions
diff --git a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java
index 688fc7e83b..29c84d2bc0 100644
--- a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java
+++ b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java
@@ -18,9 +18,11 @@
*/
package com.tuscanyscatours;
+import java.math.BigDecimal;
+
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface Checkout {
- void makePayment(double amount, String cardInfo);
+ void makePayment(BigDecimal amount, String cardInfo);
}
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);
}
}