We will write the three Classes - Cart, Shop and Checkout.
In your /src/org/confucius, create a class Cart.java, like this:
package org.confucius;
public class Cart {
private int numItems = 0;
public int getNumItems() {
return numItems;
}
public void setNumItems(int numItems) {
this.numItems = numItems;
}
}
In your /src/org/confucius, create a Class Shop.java, like this:
package org.confucius;
public class Shop {
private Cart cart = null;
public Cart getCart() {
return cart;
}
public void setCart(Cart cart) {
this.cart = cart;
}
}
In your /src/org/confucius, create a Class Checkout.java, like this:
package org.confucius;
public class Checkout {
private Cart cart = null;
public Cart getCart() {
return cart;
}
public void setCart(Cart cart) {
this.cart = cart;
}
}
No comments:
Post a Comment