-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay_22_c_bankaccount.java
More file actions
89 lines (67 loc) · 2.25 KB
/
Copy pathDay_22_c_bankaccount.java
File metadata and controls
89 lines (67 loc) · 2.25 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
package Programing.Section6;
public class Day_22_c_bankaccount {
private int account_number;
private int balance ;
private int phone_number;
private String name;
private String email;
// making a constructor
public Day_22_c_bankaccount(){
this(9999,9899,"default account","default email");
System.out.println("Empty constructor(without-parameters) is called");
}
public Day_22_c_bankaccount (int account_number , int phone_number, String name, String email){
this.account_number=account_number;
this.balance=balance;
this.phone_number=phone_number;
this.name=name;
this.email=email;
System.out.println("Account constructor with parameter is called");
}
public int getAccount_number() {
return account_number;
}
public void setAccount_number(int account_number) {
this.account_number = account_number;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
public int getPhone_number() {
return phone_number;
}
public void setPhone_number(int phone_number) {
this.phone_number = phone_number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public void deposit_funds ( int deposit ){
this.balance += deposit;
System.out.println(" An amount of "+deposit+" has been deposited successfully");
System.out.println(" current balance is:" +this.balance);
}
public int withdraw_funds( int withdraw ){
if(balance - withdraw<0){
System.out.println("only "+balance+" available . payment cannot be processed");
}
else {
this.balance -= withdraw;
System.out.println(" withdrawal of "+withdraw +" processed successfully, current balance is:" +this.balance);
return 0;
}
return this.balance;
}
}