-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeEncap.java
More file actions
27 lines (27 loc) · 956 Bytes
/
Copy pathEmployeeEncap.java
File metadata and controls
27 lines (27 loc) · 956 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
package Encapsulation;
import java.util.Scanner;
class EmployeeEncap {
private int Acc_balance;
private int pin = 266730;
public void setBalance (int balance) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Upi pin : ");
int upi_pin = sc.nextInt();
if (upi_pin == this.pin) {
Acc_balance += balance;
System.out.println(balance + " is credited into your Acc");
} else {
System.out.println("Wrong pin");
}
}
public void CheckBalance () {
System.out.print("To check balance enter your pin : ");
Scanner sc = new Scanner(System.in);
int upi_pin = sc.nextInt();
if (upi_pin == pin) {
System.out.println(this.Acc_balance + " is in your bank account");
} else {
System.out.println("!! Wrong Pin !! Unable to fetch the balance");
}
}
}