Skip to content

Instantly share code, notes, and snippets.

@isu3ru
Created March 16, 2021 08:43
Show Gist options
  • Save isu3ru/15fbac69602fc3236fbd9090023d00fe to your computer and use it in GitHub Desktop.
Save isu3ru/15fbac69602fc3236fbd9090023d00fe to your computer and use it in GitHub Desktop.
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