first comment
هذا الالتزام موجود في:
83
src/Item.java
Normal file
83
src/Item.java
Normal file
@@ -0,0 +1,83 @@
|
||||
public class Item {
|
||||
int IdOfItem ;
|
||||
static int id=0;
|
||||
String NameOfItem ;
|
||||
int Price ;
|
||||
int Quantity ;
|
||||
int TheMinimumAllowed ;
|
||||
String Category ;
|
||||
public Item( String category,String nameOfItem,int price,int quantity,int theMinimumAllowed) {
|
||||
Category=category ;
|
||||
IdOfItem =++id;
|
||||
NameOfItem = nameOfItem;
|
||||
Price=price;
|
||||
Quantity=quantity;
|
||||
TheMinimumAllowed=theMinimumAllowed ;
|
||||
}
|
||||
|
||||
|
||||
public Item(int id, String name, int price, int quantity, int minAllowed, String category) {
|
||||
this.IdOfItem = id;
|
||||
this.NameOfItem = name;
|
||||
this.Price = price;
|
||||
this.Quantity = quantity;
|
||||
this.TheMinimumAllowed = minAllowed;
|
||||
this.Category = category;
|
||||
|
||||
if (id > Item.id) {
|
||||
Item.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getIdOfItem() {
|
||||
return IdOfItem;
|
||||
}
|
||||
public String getNameOfItem() {
|
||||
return NameOfItem;
|
||||
}
|
||||
|
||||
public void setNameOfItem(String nameOfItem) {
|
||||
NameOfItem = nameOfItem;
|
||||
}
|
||||
|
||||
public int getPrice() {
|
||||
return Price;
|
||||
}
|
||||
|
||||
public void setPrice(int price) {
|
||||
Price = price;
|
||||
}
|
||||
public int getQuantity() {
|
||||
return Quantity;
|
||||
}
|
||||
public void setQuantity(int quantity) {
|
||||
Quantity = quantity;
|
||||
}
|
||||
public int getTheMinimumAllowed() {
|
||||
return TheMinimumAllowed;
|
||||
}
|
||||
|
||||
public void setTheMinimumAllowed(int theMinimumAllowed) {
|
||||
TheMinimumAllowed = theMinimumAllowed;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return Category;
|
||||
}
|
||||
public void setCategory(String category) {
|
||||
Category = category;
|
||||
}
|
||||
public void print() {
|
||||
System.out.println( "Item{"+"id:"+getIdOfItem()+" "+"name:"+ getNameOfItem() + " "+"price:" +getPrice()+" "+ "Quantity:" + getQuantity()+" "+"The minimum allowed=" + getTheMinimumAllowed()+" "+"Category:" +getCategory()+"}");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getIdOfItem() + "," +
|
||||
getNameOfItem() + "," +getCategory()+ "," +getQuantity()
|
||||
+ "," +getPrice() + "," +
|
||||
getTheMinimumAllowed()
|
||||
;
|
||||
}
|
||||
}
|
||||
المرجع في مشكلة جديدة
حظر مستخدم