school/Week-11-final-start/part-2/ItemToPurchase.java

53 lines
1.1 KiB
Java

public class ItemToPurchase {
private String itemName;
private int itemPrice;
private int itemQuantity;
private String itemDescription;
public ItemToPurchase() {
itemName = "none";
itemPrice = 0;
itemQuantity = 0;
itemDescription = "none";
}
public ItemToPurchase(String name, String Desc, int Price,
int Quantity){
this.itemName = name;
this.itemPrice = Price;
this.itemQuantity = Quantity;
this.itemDescription = Desc;
}
public void setName(String name){
this.itemName = name;
}
public String getName(){
return itemName;
}
public void setQuantity(int q){
this.itemQuantity = q;
}
public int getQuantity(){
return itemQuantity;
}
public void setPrice(int p){
this.itemPrice = p;
}
public int getPrice(){
return itemPrice;
}
public void setDescription(String Desc){
this.itemDescription = Desc;
}
public void printItemCost(){
System.out.println(itemName + " " + itemQuantity + " @ $" + itemPrice +
" = $" + (itemQuantity*itemPrice));
}
public void printItemDescription(){
System.out.println(itemName + ": " + itemDescription);
}
}