Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. import java.util.Scanner;
  2. class customer
  3. {
  4. customer(int b, String user, int password)
  5. {
  6. Balance = b;
  7. username = user;
  8. this.password = password;
  9. }
  10.  
  11.  
  12. double Balance;
  13. String username;
  14. int password;
  15. void ChangeUserName(String newUsername)
  16. {
  17. username = newUsername;
  18. }
  19. double Withdraw(double amount) {Balance = Balance - amount; return Balance - amount; }
  20. }
  21.  
  22. class Main {
  23. public static void main(String[] args) {
  24. Scanner sc = new Scanner(System.in );
  25. customer newCustomer = new customer(4000, "David.C", 12345);
  26. customer newCustomer = new customer(400, "David", 1234);
  27. newCustomer.Balance = 4000;
  28. System.out.println("User Name ");
  29.  
  30. String input = sc.nextLine();
  31. while(!input.equals(newCustomer.username))
  32. {
  33. System.out.println("User Not Found");
  34. input = sc.nextLine();
  35. }
  36. if(input.equals(newCustomer.username));
  37. {
  38. System.out.println("Password");
  39. String input1 = sc.nextLine();
  40. while(!input1.equals("12345"))
  41. {
  42. System.out.println("Inorrect Password ");
  43. input1 = sc.nextLine();
  44. }
  45. if(input1.equals("12345"))
  46. {
  47. System.out.println("Correct Password");
  48. }
  49. System.out.println("Current balance:"+newCustomer.Balance);
  50. input = sc.nextLine();
  51. if(input.equals("Withdraw"))
  52. {
  53. System.out.println("Set Number:");
  54. double input2 = sc.nextDouble();
  55. newCustomer.Balance = newCustomer.Balance - input2;
  56. System.out.println(newCustomer.Balance);
  57.  
  58. }
  59. else if(input.equals("Deposit"))
  60. {
  61. System.out.println("Set Number:");
  62. double input3 = sc.nextDouble();
  63. newCustomer.Balance = newCustomer.Balance + input3;
  64. System.out.println(newCustomer.Balance);
  65.  
  66. }
  67. }
  68.  
  69. }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement