Instructions
Requirements and Specifications
Source Code
public class Kicks {
final static int MAX_VALUE = 100;
final static int LARGE_ORDER_THRESHOLD = 10;
final static double DISCOUNT = 20.00;
private int size;
private String brand;
private double price;
private int qty;
public Kicks(){
this(10, "Adidas", 65.99, 1);
}
public Kicks(int size, String brand, double price, int qty){
this.size = size;
this.brand = brand;
this.price = price;
this.qty = qty;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public double getPrice() {
return isLargeOrder() ? (price - DISCOUNT) : price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public boolean isLargeOrder() {
return qty >= LARGE_ORDER_THRESHOLD;
}
public void displayShoeInfo(){
System.out.println("Shoe Size >>" + size);
System.out.println("Shoe Brand >>" + brand);
System.out.println("Shoe Price >>" + price);
System.out.println("Quantity >>" + qty);
System.out.println("Total Price >>" + qty * getPrice());
System.out.println("Large order >>" + isLargeOrder());
}
public static void displayMotto(){
System.out.println("- - - - - - - - - - -" +
"\n| Cobell's Kicks | " +
"\n| Flyest kicks | " +
"\n| Sleakest Styles |" +
"\n| Get Style today |" +
"\n- - - - - - - - - - -");
}
public static void displayThanks() {
System.out.println("Thank you for the purchase come again");
}
public static Kicks getLarger(Kicks kicks1, Kicks kicks2) {
double totalPrice1 = kicks1.qty * kicks1.getPrice();
double totalPrice2 = kicks2.qty * kicks2.getPrice();
int diff = Double.compare(totalPrice1, totalPrice2);
if (diff < 0) {
return kicks2;
}
else {
return kicks1;
}
}
}