You may need other classes to use them as internal complex type of your shopping cart. Create a class OnlineStore. This class has a method order summery, this method accepts the cart and information of the owner of the cart, sums up the prices, calculates the tax and shipping cost and produces an Order object, this object has a field totalPrice and a field owner of order. Design a class CheckoutSystem. Each checkout system has a method checkout that accepts the order and a credit cart as arguments and checkouts the items. we don’t care how internally this method works, the only task that it does right now is to produce a confirmation number and return it. Show the order summery. Create a class OnlineOrderTestDrive. Create the main method inside. Inside your main method create a list of items and add them to a shopping cart object. Create an instance of the OnlineOrder class and call the orderSummery method of that class. Store the result in a variable. Create an instance of the CheckoutSystem and call the checkout method of that object. Show the confirmation message. Note that there are internal classes that exist but I didn’t mention them. there is a example

The instructions provided require the creation of several classes to implement a shopping cart system. I will outline the necessary steps and provide a sample implementation in Java.

Firstly, we need to create a class called “OnlineStore” which will have a method called “orderSummary.” This method should accept the cart (presumably an object representing the items in the shopping cart) and information about the cart’s owner (perhaps an object representing the customer). The method should calculate the total price of the items in the cart, including any applicable tax and shipping costs. The result should be returned as an Order object, which should have fields for the totalPrice and the owner of the order.

Next, we need to design a class called “CheckoutSystem.” This class should have a method called “checkout” that accepts an Order object and a credit card object as arguments. The purpose of this method is to process the checkout and return a confirmation number. The specific implementation details of how this process works are not specified, so we will assume that it is handled internally within the CheckoutSystem class.

The next step is to create a class called “OnlineOrderTestDrive” which will serve as the main method entry point. Inside the main method, we will create a list of items and add them to a shopping cart object. Then, an instance of the OnlineStore class will be created and the “orderSummary” method will be called, storing the result in a variable.

After that, an instance of the CheckoutSystem class will be created and the “checkout” method will be called with the Order object and a credit card object as arguments. Finally, the confirmation message will be displayed.

To provide an example implementation, please see the code snippet below:

“`java
import java.util.List;

class OnlineStore {
public Order orderSummary(Cart cart, Owner owner) {
double totalPrice = 0.0;
// calculate total price based on items in the cart
for (Item item : cart.getItems()) {
totalPrice += item.getPrice();
}
// add tax and shipping costs
totalPrice += calculateTax(totalPrice);
totalPrice += calculateShipping(cart);
return new Order(totalPrice, owner);
}

private double calculateTax(double totalPrice) {
// calculate tax based on total price
// implementation details omitted
return 0.0;
}

private double calculateShipping(Cart cart) {
// calculate shipping cost based on items in the cart
// implementation details omitted
return 0.0;
}
}

class CheckoutSystem {
public String checkout(Order order, CreditCard creditCard) {
// process checkout and obtain confirmation number
// implementation details omitted
return “12345”;
}
}

class OnlineOrderTestDrive {
public static void main(String[] args) {
List items = createItems();
Cart cart = new Cart(items);

OnlineStore onlineStore = new OnlineStore();
Order order = onlineStore.orderSummary(cart, new Owner());

CheckoutSystem checkoutSystem = new CheckoutSystem();
String confirmationMessage = checkoutSystem.checkout(order, new CreditCard());

System.out.println(“Confirmation: ” + confirmationMessage);
}

private static List createItems() {
// create and return a list of items
// implementation details omitted
return new ArrayList<>();
}
}

class Cart {
private List items;

public Cart(List items) {
this.items = items;
}

public List getItems() {
return items;
}
}

class Item {
private String name;
private double price;

public Item(String name, double price) {
this.name = name;
this.price = price;
}

public String getName() {
return name;
}

public double getPrice() {
return price;
}
}

class Owner {
// owner information and methods
}

class Order {
private double totalPrice;
private Owner owner;

public Order(double totalPrice, Owner owner) {
this.totalPrice = totalPrice;
this.owner = owner;
}

// getters and setters
}

class CreditCard {
// credit card information and methods
}
“`

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer