-
Notifications
You must be signed in to change notification settings - Fork 0
/
ThongTinKhuyenMai.java
63 lines (52 loc) · 1.19 KB
/
ThongTinKhuyenMai.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
package fastfoodanddrinkstore;
import java.util.Scanner;
public class ThongTinKhuyenMai extends KhuyenMai {
private int percent;
private String qua;
//Constructor
public ThongTinKhuyenMai() {
super();
percent=50;
qua="Chai dau an Truong Son";
}
public ThongTinKhuyenMai(String makm, String mota, String ngbd, String ngkt, String masp, int percent,
String qua) {
super(makm, mota, ngbd, ngkt, masp);
this.percent = percent;
this.qua = qua;
}
public ThongTinKhuyenMai(ThongTinKhuyenMai in) {
super((KhuyenMai)in);
percent = in.percent;
qua = in.qua;
}
//GETTER SETTER
public int getPercent() {
return percent;
}
public void setPercent(int percent) {
this.percent = percent;
}
public String getQua() {
return qua;
}
public void setQua(String qua) {
this.qua = qua;
}
@Override public void nhap()
{
Scanner sc = new Scanner(System.in);
super.nhap();
do{
System.out.print("Nhap phan tram giam gia: ");
this.setPercent(sc.nextInt());
}while(percent < 0 || percent > 100);
System.out.print("Nhap qua tang:");
this.setQua(sc.nextLine());
}
@Override public void xuat()
{
super.xuat();
System.out.println(percent + " | " + qua);
}
}