-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.java
More file actions
41 lines (41 loc) · 892 Bytes
/
Copy pathAccount.java
File metadata and controls
41 lines (41 loc) · 892 Bytes
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
import java.util.*;
public class Account extends Bank
{
double amt;
Account(double p,int a,String n)
{
super(p,a,n);
amt=0.0;
}
void deposit()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the amount");
amt=sc.nextDouble();
P=P+amt;
}
void withdraw()
{
double p;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the amount");
amt=sc.nextDouble();
if(amt>P)
System.out.println("Insufficient balance");
else
{
P=P-amt;
if(P<500)
{
p=(5/100.0)*P;
System.out.println("Penalty is Rs "+p);
P=P-p;
}
}
}
void display()
{
super.display();
System.out.println("Remaining Balance="+P);
}
}