package Invoiceitem;
import java.util.Scanner;
public class InfoItem {
private String id;
private String decs;
private int qty;
private double unitPrice;
public InfoItem() {
}
public InfoItem(String id, String decs, int qty, double unitPrice) {
super();
this.id = id;
this.decs = decs;
this.qty = qty;
this.unitPrice = unitPrice;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
}
public String getDecs() {
return decs;
}
public void setDecs(String decs) {
this.decs = decs;
}
public double getTotal() {
return unitPrice*qty;
}
public String toString() {
return "ID="+id+","+"Desc="+decs+","+"Qty="+Integer.toString(qty)+","+"UnitPrice="+Double.toString(unitPrice);
}
public void nhap() {
Scanner input = new Scanner (System.in);
System.out.print("Nhap vao MA SO: ");
this.id = input.nextLine();
System.out.print("Nhap vao SO LUONG: ");
this.qty = input.nextInt();
System.out.print("Nhap vao GIA BAN: ");
this.unitPrice = input.nextDouble();
System.out.print("Them MO TA: ");
this.decs = input.nextLine();
}
public void xuat() {
System.out.println("MA SO = "+this.id);
System.out.println("SO LUONG = "+this.qty);
System.out.println("GIA BAN = "+this.unitPrice);
System.out.println("MO TA : "+this.decs);
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.