-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprg5.java
More file actions
123 lines (104 loc) · 3.03 KB
/
prg5.java
File metadata and controls
123 lines (104 loc) · 3.03 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
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
//
import java.util.*;
class prg5{
static class Person
{
String name , address , email , mobile;
void input_person()
{
Scanner sc = new Scanner(System.in);
System.out.println("\nEnter name :");
name = sc.nextLine();
System.out.println("\nEnter address :");
address = sc.nextLine();
System.out.println("\nEnter email :");
email = sc.nextLine();
System.out.println("\nEnter mobile :");
mobile = sc.nextLine();
}
void output_person()
{
System.out.println("\nName : " + name);
System.out.println("\naddress : " + address);
System.out.println("\nemail : " + email);
System.out.println("\nmobile : " + mobile);
}
}
static class accountHolder extends Person
{
String accno;
String type;
float amount , interest;
void input_account()
{
Scanner sc = new Scanner(System.in);
input_person();
System.out.println("\nEnter accno :");
accno = sc.nextLine();
System.out.println("\nEnter type :");
type = sc.nextLine();
System.out.println("\nEnter amount :");
amount = sc.nextFloat();
}
void output_account()
{
output_person();
System.out.println("\naccno : " + accno);
System.out.println("\ntype : " + type);
System.out.println("\namount : " + amount);
System.out.println("\ninterest : " + interest);
}
void calc_interest()
{
}
String retType()
{
return type;
}
}
static class SBI extends accountHolder
{
float int_rate_sb , int_rate_ca;
SBI()
{
int_rate_ca = 0;
int_rate_sb = 0;
}
void input_accountHolder()
{
Scanner sc = new Scanner(System.in);
input_account();
String specType = retType();
if(specType.equals("SB"))
{
System.out.println("\nEnter interest rate SB : ");
int_rate_sb = sc.nextFloat();
calc_interest();
}
else
{
System.out.println("\nEnter interest rate CA : ");
int_rate_ca = sc.nextFloat();
calc_interest();
}
}
@Override
void calc_interest() {
super.calc_interest();
if(type.equals("SB"))
interest = super.amount * int_rate_sb / 100;
else
interest = super.amount * int_rate_ca / 100;
}
void output_SBI()
{
output_account();
}
}
public static void main(String args[])
{
SBI x = new SBI();
x.input_accountHolder();
x.output_SBI();
}
}