Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. class User
  2. {
  3. public:
  4. //Constructors
  5. User();
  6. User(string user, int card, int pin);
  7.  
  8. //Methods
  9. void viewAccount();
  10. void withdraw();
  11. void deposit();
  12. string getUser() { return mUserName; };
  13. int getCard() { return mCard; };
  14. int getPin() { return mPin; };
  15. double getBalance() { return mBalance; };
  16.  
  17. private:
  18. string mUserName;
  19. int mCard;
  20. int mPin;
  21. double mBalance;
  22. };
  23.  
  24.  
  25. User::User(string user, int card, int pin)
  26. {
  27. //Manual user input
  28. mUserName = user;
  29. mCard = card;
  30. mPin = pin;
  31. mBalance = 0;
  32. }
  33.  
  34. void User::viewAccount()
  35. {
  36. cout << "User Name = " << mUserName << endl;
  37. cout << "Card Number = " << mCard << endl;
  38. cout << "Your PIN = " << mPin << endl;
  39. cout << "Balance = " << mBalance << endl;
  40. }
  41.  
  42. int main() {
  43. cout << "Welcome" << endl;
  44. cout << "Enter 1 if you are a new user" << endl;
  45. cout << "Enter 2 if you are a returning user" << endl;
  46. int input;
  47. cin >> input;
  48.  
  49. if (input == 1)
  50. {
  51. string user;
  52. cout << "Please enter a user name" << endl;
  53. cin >> user;
  54.  
  55. int card;
  56. cout << "Please enter your card number" << endl;
  57. cin >> card;
  58.  
  59. int pin;
  60. cout << "Please enter a PIN number" << endl;
  61. cin >> pin;
  62.  
  63. User Example(user, card, pin);
  64.  
  65. Example.viewAccount();
  66.  
  67.  
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement