-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.java
More file actions
51 lines (44 loc) · 1.13 KB
/
Copy pathAccount.java
File metadata and controls
51 lines (44 loc) · 1.13 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
import java.util.*;
class Account {
int acc_no;
double balance;
void input() {
Scanner sc = new Scanner(System.in);
System.out.print("Enter account number : ");
acc_no = sc.nextInt();
System.out.print("Enter balance : ");
balance = sc.nextDouble();
}
void disp() {
System.out.println("Account number : " + acc_no + "\nBalance : " + balance);
}
}
class Person extends Account {
String name;
long aadhar_no;
void input() {
super.input();
Scanner sc = new Scanner(System.in);
System.out.print("Enter name : ");
name = sc.nextLine();
System.out.print("Enter aadhar number : ");
aadhar_no = sc.nextLong();
}
void disp() {
super.disp();
System.out.println("Name : " + name + "\nAadhar number : " + aadhar_no);
}
}
class ex4 {
public static void main(String args[]) {
Person p1 = new Person();
Person p2 = new Person();
Person p3 = new Person();
p1.input();
p2.input();
p3.input();
p1.disp();
p2.disp();
p3.disp();
}
}