Created
March 16, 2021 08:43
-
-
Save isu3ru/15fbac69602fc3236fbd9090023d00fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class AskPass { | |
public static void main(String[] args) { | |
int password = 1234; | |
double amount = 5674.25; | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter your PIN number : "); | |
int pinNumber = sc.nextInt(); | |
// check if pin number entered matches the password | |
if (pinNumber == password) { | |
System.out.println("Welcome Thilini."); | |
// show user hidden data | |
System.out.println("You have a running balance of " + amount); | |
System.out.println("Thank you for using our service."); | |
System.out.println("Bye."); | |
} else { | |
System.out.println("Your password is wrong."); | |
System.out.println("Access denied."); | |
System.out.println("System is exiting."); | |
} | |
// close the program | |
System.exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment