Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <iostream>
  4. #include <iomanip>
  5. #include <string>
  6. #include <Windows.h>
  7.  
  8. using namespace std;
  9.  
  10. class customer
  11. {
  12. public:
  13. customer();
  14. ~customer();
  15. void getLogin();
  16. void getProfileInfo(string &fName, string &sName, string &address);
  17. void getPaymentInfo();
  18.  
  19. protected:
  20. string fName;
  21. string sName;
  22. string address;
  23.  
  24. };
  25.  
  26. // Constructor
  27.  
  28. customer::customer()
  29. {
  30. fName = "";
  31. sName = "";
  32. address = "";
  33.  
  34. // Initialises Variables
  35. }
  36.  
  37.  
  38. // Destructor
  39.  
  40. customer::~customer()
  41. {
  42. }
  43.  
  44.  
  45. // Customer Log In
  46.  
  47. void customer::getLogin()
  48. {
  49. string username;
  50. string password;
  51.  
  52. cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Log In~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" << endl;
  53. cout << "\n Welcome to the Bucks Centre Performing Arts Ticket Purchasing System" << endl;
  54. cout << "Please Log In" << endl;
  55.  
  56. cout << "Enter Username: ";
  57. getline(cin, username);
  58.  
  59. while (username.length() > 10)
  60. {
  61. cout << "Your username cannot be more than 10 characters long." << endl;
  62. cout << "Please re-enter your username: ";
  63. getline(cin, username);
  64. }
  65.  
  66. cout << "Enter Password: ";
  67. getline(cin, password);
  68.  
  69. while (password.length() > 10)
  70. {
  71. cout << "Your password cannot be more than 10 characters long." << endl;
  72. cout << "Please re-enter your password: ";
  73. getline(cin, password);
  74. }
  75.  
  76.  
  77. }
  78.  
  79.  
  80. // Customer Profile Information
  81.  
  82. void customer::getProfileInfo(string &fName, string &sName, string &address)
  83. {
  84. char ch, terminator;
  85.  
  86. do
  87. {
  88. cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Personal Profile~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" << endl;
  89. cout << "Please enter your details" << endl;
  90.  
  91.  
  92. // Customer Firstname
  93.  
  94. cout << "Enter your Firstname: ";
  95. getline(cin, fName);
  96.  
  97. while (fName.length() > 40)
  98. {
  99. cout << "Too many characters." << endl;
  100. cout << "Please re-enter your firstname: ";
  101. getline(cin, fName);
  102. }
  103.  
  104.  
  105.  
  106.  
  107.  
  108. // Customer Surname
  109.  
  110. cout << "Enter your Surname: ";
  111. getline(cin, sName);
  112.  
  113. while (sName.length() > 40)
  114. {
  115. cout << "Too many characters." << endl;
  116. cout << "Please re-enter your surname: ";
  117. getline(cin, sName);
  118. }
  119.  
  120.  
  121.  
  122.  
  123.  
  124. // Customer Address
  125.  
  126. cout << "Enter your Address: ";
  127. getline(cin, address);
  128.  
  129. while (address.length() > 60)
  130. {
  131. cout << "Too many characters." << endl;
  132. cout << "Please re-enter your address: ";
  133. getline(cin, address);
  134. }
  135.  
  136.  
  137.  
  138. do
  139. {
  140. cout << "\nAre you happy with the details you have entered (Y = Yes, N = No)?: ";
  141. cin.get(ch);
  142.  
  143. } while (ch != 'Y' && ch != 'y' && ch != 'N' && ch != 'n');
  144.  
  145. cin.get(terminator); // Clears buffer
  146.  
  147. } while (ch == 'N' || ch == 'n');
  148.  
  149.  
  150.  
  151. }
  152.  
  153. // Customer Payment Details
  154.  
  155. void customer::getPaymentInfo()
  156. {
  157.  
  158. string bUsername;
  159. string bPassword;
  160.  
  161. cout << "Please enter your bank username and password" << endl;
  162.  
  163. cout << "Enter Bank Username: ";
  164. getline(cin, bUsername);
  165.  
  166. while (bUsername.length() > 10)
  167. {
  168. cout << "Your bank username cannot be more than 10 characters long." << endl;
  169. cout << "Please re-enter your bank username: ";
  170. getline(cin, bUsername);
  171. }
  172.  
  173. cout << "Enter Bank Password: ";
  174. getline(cin, bPassword);
  175.  
  176. while (bPassword.length() > 10)
  177. {
  178. cout << "Your bank password cannot be more than 10 characters long." << endl;
  179. cout << "Please re-enter your bank password: ";
  180. getline(cin, bPassword);
  181. }
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement