📄 item.java
字号:
// Code Written by Kevin Dela Rosa, Vinney LaPenna, and John Sameulson June 14, 2004
/***********************************************************************************/
/** **/
/** Inventory Deluxe v 1.03 **/
/** Item Class **/
/** **/
/***********************************************************************************/
public class Item
{
private String name;
private String description;
private String idNumber;
private int amount;
private double salesPrice;
private double orderPrice;
public Item()
{
name = "";
description = "";
idNumber = "";
amount = 0;
salesPrice = 0.0;
orderPrice = 0.0;
}
public Item(String n, String d, String id, int a, double s, double o)
{
name = n;
description = d;
idNumber = id;
amount = a;
salesPrice = s;
orderPrice = o;
}
public String getName()
// returns name of the item
{
return name;
}
public String getDescription()
// returns the description of the item
{
return description;
}
public String getId()
// returns the ID number of the item
{
return idNumber;
}
public int getAmount()
{
return amount;
}
public double getSalesPrice()
{
return salesPrice;
}
public double getSalesPrice(int a)
{
return salesPrice * a;
}
public double getOrderPrice()
{
return orderPrice;
}
public double getOrderPrice(int a)
{
return orderPrice * a;
}
public double orderItem(int orderAmount)
// Returns the cost of the order for the company
// Increases amount by orderAmount
{
amount += orderAmount;
return orderAmount * orderPrice;
}
public double sellItem(int sellAmount)
// Returns the cost of the order for the customer
// Decreases amount by sellAmount
{
amount -= sellAmount;
return sellAmount * salesPrice;
}
public double liquidate()
// Returns the price
{
return amount * orderPrice;
}
public void setSalesPrice(double a)
{
salesPrice = a;
}
public void setOrderPrice(double a)
{
orderPrice = a;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -