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.
88 lines
1.4 KiB
88 lines
1.4 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;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param newAmount of items
|
|
*/
|
|
public void updateAvailability(int newAmount) {
|
|
availability = newAmount;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param newPrice of this item.
|
|
*/
|
|
public void updatePrice(float newPrice) {
|
|
this.price = newPrice;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return Current Price of the Item.
|
|
*/
|
|
public float getCurrentPrice() {
|
|
return price;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return Current public Title of this Item.
|
|
*/
|
|
public String getTitel() {
|
|
return this.productTitle;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return Current public Description of this Item.
|
|
*/
|
|
public String getDescription() {
|
|
return this.description;
|
|
}
|
|
}
|