-
Notifications
You must be signed in to change notification settings - Fork 0
/
CTHoaDonXuat.java
133 lines (94 loc) · 2.25 KB
/
CTHoaDonXuat.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package fastfoodanddrinkstore;
import java.util.Scanner;
public class CTHoaDonXuat {
private String mahd;
private String masp;
private int dongia;
private int thanhtien;
private int soluong;
private String makm;
//Constructor;
public CTHoaDonXuat() {
this("HD001","SP001",6000,75000,3,"KM001");
}
public CTHoaDonXuat(String mahd, String masp, int dongia, int thanhtien, int soluong, String makm) {
super();
this.mahd = mahd;
this.masp = masp;
this.dongia = dongia;
this.thanhtien = thanhtien;
this.soluong = soluong;
this.makm = makm;
}
public CTHoaDonXuat(CTHoaDonXuat hd) {
this(hd.mahd, hd.masp, hd.dongia,hd.thanhtien, hd.soluong, hd.makm);
}
//GETTER SETTER
public String getMahd() {
return mahd;
}
public void setMahd(String mahd) {
this.mahd = mahd;
}
public String getMasp() {
return masp;
}
public void setMasp(String masp) {
this.masp = masp;
}
public int getDongia() {
return dongia;
}
public void setDongia(int dongia) {
this.dongia = dongia;
}
public int getThanhtien() {
return thanhtien;
}
public void setThanhtien(int thanhtien) {
this.thanhtien = thanhtien;
}
public int getSoluong() {
return soluong;
}
public void setSoluong(int soluong) {
this.soluong = soluong;
}
public String getMakm() {
return makm;
}
public void setMakm(String makm) {
this.makm = makm;
}
//nhap
public void nhap() {
Scanner sc = new Scanner(System.in);
do {
System.out.print("Nhap ma hoa don(5 ki tu): ");
this.setMahd(sc.nextLine());
}while(mahd.length()!=5);
do {
System.out.print("Nhap ma san pham(5 ki tu): ");
this.setMasp(sc.nextLine());
}while(masp.length()!=5);
do{
System.out.print("Nhap don gia: ");
this.setDongia(sc.nextInt());
}while(dongia%1000!=0);
do{
System.out.print("Nhap thanh tien: ");
this.setThanhtien(sc.nextInt());
}while(thanhtien%1000!=0);
do{
System.out.print("Nhap so luong: ");
this.setSoluong(sc.nextInt());
}while(soluong <= 0);
do{
System.out.print("Nhap ma khuyen mai(5 ki tu): ");
this.setMakm(sc.nextLine());
}while(makm.length()!=5);
}
public void xuat() {
System.out.println(mahd + " | " + masp + " | " + dongia + " | " + thanhtien + " | " + soluong + " | " + makm);
}
}