Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class customer
- {
- customer(int b, String user, int password)
- {
- Balance = b;
- username = user;
- this.password = password;
- }
- double Balance;
- String username;
- int password;
- void ChangeUserName(String newUsername)
- {
- username = newUsername;
- }
- double Withdraw(double amount) {Balance = Balance - amount; return Balance - amount; }
- }
- class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in );
- customer newCustomer = new customer(4000, "David.C", 12345);
- customer newCustomer = new customer(400, "David", 1234);
- newCustomer.Balance = 4000;
- System.out.println("User Name ");
- String input = sc.nextLine();
- while(!input.equals(newCustomer.username))
- {
- System.out.println("User Not Found");
- input = sc.nextLine();
- }
- if(input.equals(newCustomer.username));
- {
- System.out.println("Password");
- String input1 = sc.nextLine();
- while(!input1.equals("12345"))
- {
- System.out.println("Inorrect Password ");
- input1 = sc.nextLine();
- }
- if(input1.equals("12345"))
- {
- System.out.println("Correct Password");
- }
- System.out.println("Current balance:"+newCustomer.Balance);
- input = sc.nextLine();
- if(input.equals("Withdraw"))
- {
- System.out.println("Set Number:");
- double input2 = sc.nextDouble();
- newCustomer.Balance = newCustomer.Balance - input2;
- System.out.println(newCustomer.Balance);
- }
- else if(input.equals("Deposit"))
- {
- System.out.println("Set Number:");
- double input3 = sc.nextDouble();
- newCustomer.Balance = newCustomer.Balance + input3;
- System.out.println(newCustomer.Balance);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement