-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenhAn.java
More file actions
55 lines (48 loc) · 1.59 KB
/
Copy pathBenhAn.java
File metadata and controls
55 lines (48 loc) · 1.59 KB
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
import java.util.Scanner;
public class BenhAn extends BenhNhan{
public BenhAn() {
}
private String TenBenhAn;
private int Tien;
public BenhAn(String hoten, String quequan, int namsinh, String tenBenhAn, int Tien) {
super(hoten, quequan, namsinh);
this.TenBenhAn = tenBenhAn;
this.Tien = Tien;
}
public String getTenBenhAn() {
return TenBenhAn;
}
public void setTenBenhAn(String tenBenhAn) {
this.TenBenhAn = tenBenhAn;
}
public int getTien() {
return Tien;
}
public void setTien(int tien) {
this.Tien = tien;
}
public void addBenhAn() {
Scanner sc = new Scanner(System.in);
System.out.println("Nhap thong tin ve benh an\n_____________ ");
System.out.println("\nNhap ten:");
super.setHoten(sc.nextLine());
System.out.println("\nNhap que quan:");
super.setQuequan(sc.nextLine());
System.out.println("\nNhap nam sinh");
super.setNamsinh(Integer.parseInt(sc.nextLine()));
System.out.println("\nNhap benh an");
this.setTenBenhAn(sc.nextLine());
System.out.println("\nNhap tien benh an");
this.setTien(sc.nextInt());
}
public void outBenhAn() {
System.out.println("Ten: " +getHoten());
System.out.println("Que quan: "+ getQuequan());
System.out.println("Nam sinh: " + getNamsinh());
System.out.println("Ten benh an: " +getTenBenhAn());
System.out.println("Tien benh an: " +getTien());
}
public int getTinhTuoi(){
return 2022-super.getNamsinh();
}
}