You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.1 KiB

package de.hs_fulda.ciip.projjpn;
public class Item {
private String productTitle;
private String description;
private int availability = 0;
private float price;
/**
* Creation of blank Item.
*/
public Item() {
}
/**
* Creation of Item.
* @param titel
* @param description
* @param quantity
* @param price
*/
public Item(String titel,
String description,
int quantity,
float price) {
this.productTitle = titel;
this.description = description;
this.availability = quantity;
this.price = price;
}
/**
*
* @return true if at least one item is in stock.
*/
public boolean inStock() {
return availability > 0;
}
/**
*
* @return current number of this items
*/
public float getCurrentStock() {
return availability;
}
public void updateAvailability(int newAmount) {
availability = newAmount;
}
public void updatePrice(float price) {
this.price = price;
}
public float getCurrentPrice() {
return price;
}
public String getTitel() {
return this.productTitle;
}
public String getDescription() {
return this.description;
}
}