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

53 lines
1.1 KiB
Java
Raw Normal View History

2020-11-11 09:46:43 -05:00
public class ItemToPurchase {
private String itemName;
private int itemPrice;
private int itemQuantity;
2020-11-11 10:46:50 -05:00
private String itemDescription;
2020-11-11 09:46:43 -05:00
public ItemToPurchase() {
itemName = "none";
itemPrice = 0;
itemQuantity = 0;
2020-11-11 10:46:50 -05:00
itemDescription = "none";
}
public ItemToPurchase(String name, String Desc, int Price,
int Quantity){
this.itemName = name;
this.itemPrice = Price;
this.itemQuantity = Quantity;
this.itemDescription = Desc;
2020-11-11 09:46:43 -05:00
}
2020-11-11 10:46:50 -05:00
2020-11-11 09:46:43 -05:00
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;
}
2020-11-11 10:46:50 -05:00
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);
}
2020-11-11 09:46:43 -05:00
}