Guest User

Untitled

a guest
Feb 16th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.74 KB | None | 0 0
  1. //Jesufarahanmi Fadamiro
  2. //Youtube
  3. // G++ Project#2-1
  4. //Projedt#2.cpp
  5.  
  6.  
  7.  
  8.  
  9.  
  10. #include <iostream>
  11. #include <vector>
  12. #include <string>
  13. #include <fstream>
  14. #include <ostream>
  15. #include <array>
  16.  
  17. using namespace std;
  18.  
  19.  
  20. class menu;
  21. class admin;
  22. class member;
  23. class client;
  24. class account;
  25.  
  26. int const databasesize = 50;
  27.  
  28. class menu {
  29. public:
  30.  
  31. menu();
  32.  
  33. void seeMain();
  34. void membermenu();
  35. void seeuserlogin();
  36. bool certification(string, string, vector <member>);
  37. void showAdminMenu();
  38. void showrequest();
  39. member returnmember(string, string, vector <member>);
  40. };
  41.  
  42. class admin {
  43. public:
  44.  
  45. admin();
  46.  
  47. string name;
  48. string password;
  49. int verify;
  50. void setadminname(string);
  51. void setadminpass(string);
  52. string getadminname(string);
  53. string getadminpass(string);
  54. int getverify();
  55. void setverify(int);
  56. void addnewmember(vector <member>&);
  57. void deletemember(vector <member>&);
  58. void displaybranch(vector <member>);
  59. void changepassword(member, vector <member>&);
  60.  
  61. };
  62.  
  63. class member {
  64. public:
  65.  
  66. member();
  67.  
  68. string name;
  69. string password;
  70. void setuserMemberInfo(string);
  71. void setuserpassword(string);
  72. void changeuserpass(member, vector <member>&);
  73. void addmember(string, string, int, string, int, vector <client>);
  74. string getmembername();
  75. string getuserpassword();
  76. int getverification();
  77. void setverification(int);
  78.  
  79. int verification = 0;
  80. };
  81.  
  82. class account {
  83. public:
  84.  
  85. account();
  86.  
  87. int useracctnum;
  88. string name;
  89. string useracctype;
  90. int userbalance;
  91. void setuseracctname(string);
  92. void setuseraccttype(string);
  93. void setuseracctbalance(int);
  94. void setuseracctnum(int);
  95. string getuseracctname();
  96. string getuseraccttype();
  97. int getuserbalance();
  98. int getuseracctnum();
  99. int getuserverification();
  100. void setuserverification(int);
  101. void userdeposit(int);
  102. void userwithdraw(int);
  103.  
  104. int verification = 0;
  105. };
  106.  
  107. class client {
  108. public:
  109.  
  110. client();
  111. account clientaccount;
  112. class account;
  113.  
  114. string userclientname;
  115. string useraddress;
  116. int userssninfo;
  117. string useremployerinfo;
  118. int userincomeinfo;
  119. void setuserclientname(string);
  120. void setuseraddress(string);
  121. void setuserssninfo(int);
  122. void setuseremployerinfo(string);
  123. void setuserincomeinfo(int);
  124. string getclientnameinfo();
  125. string getuseraddressinfo();
  126. int getuserssn();
  127. string getuseremployer();
  128. int getuserincome();
  129. int getverification();
  130. void setverification(int);
  131.  
  132. int verification = 0;
  133. };
  134.  
  135. menu::menu() {
  136. }
  137.  
  138. admin::admin(){
  139. string username = "NA";
  140. string userpassword = "NA";
  141.  
  142. int verification = 0;
  143. }
  144.  
  145. member::member() {
  146. string username = "NA";
  147. string userpassword = "NA";
  148.  
  149. int verification = 0;
  150. }
  151.  
  152. client::client() {
  153. string userclientname = "NA";
  154. string useraddress = "NA";
  155. int userssninfo = 0;
  156. string employerinfo = "NA";
  157. int userincomeinfo = 0;
  158.  
  159. int verification = 0;
  160. }
  161.  
  162. account::account() {
  163. int useracctnum = 0;
  164. string username = "NA";
  165. string useraccttype = "NA";
  166. int userbalance = 0;
  167.  
  168. int verification = 0;
  169. }
  170.  
  171. void menu::seeMain() {
  172. cout << "\t===========================================================\n";
  173. cout << "\t| Welcome to the Auburn Branch of Tiger Bank! |\n";
  174. cout << "\t===========================================================\n";
  175. cout << "1) Login\n";
  176. cout << "2) Quit\n";
  177. }
  178.  
  179. bool menu::certification(string nameIn, string passIn, vector <member> database){
  180. bool valid = false;
  181. int index;
  182. for(index = 0; index < databasesize; index++){
  183. if(database[index].getmembername() == nameIn && database[index].getuserpassword() == passIn){
  184. valid = true;
  185. break;
  186. }
  187. else {
  188. valid = false;
  189. }
  190. }
  191. return valid;
  192. }
  193.  
  194. void menu::seeuserlogin() {
  195. cout << "\t===========================================================\n";
  196. cout << "\t| Login to Access the Teller Terminal System |\n";
  197. cout << "\t===========================================================\n";
  198. }
  199.  
  200. member menu::returnmember(string nameIn, string passIn, vector <member> database){
  201. member retrieve;
  202. for(int index = 0; index < databasesize; index++){
  203. if(database[index].getmembername() == nameIn && database[index].getuserpassword() == passIn){
  204. retrieve.setverification(database[index].getverification());
  205. retrieve.setuserpassword(database[index].getuserpassword());
  206. retrieve.setuserMemberInfo(database[index].getmembername());
  207. break;
  208. }
  209. }
  210. return retrieve;
  211. }
  212.  
  213. void menu::showAdminMenu() {
  214. cout << "\t===========================================================\n";
  215. cout << "\t| Teller Terminal System – System Administration |\n";
  216. cout << "\t===========================================================\n";
  217. cout << "1) Client and Account Management\n";
  218. cout << "2) Add a branch staff member\n";
  219. cout << "3) Delete a branch staff member\n";
  220. cout << "4) Display branch staff\n";
  221. cout << "5) Change password\n";
  222. cout << "6) Exit\n";
  223. cout << "\tPlease choose an option: ";
  224. }
  225.  
  226.  
  227. void admin::setadminname(string nameIn) {
  228. name = nameIn;
  229. }
  230.  
  231. void admin::setadminpass(string passwordIn) {
  232. password = passwordIn;
  233. }
  234.  
  235. void admin::changepassword(member currentmemberinfo, vector <member>& database) {
  236. string passIn;
  237.  
  238. do{
  239. cout << "New Password: ";
  240. cin >> passIn;
  241. if (passIn == currentmemberinfo.getuserpassword()){
  242. cout << "Error - Your new password must be different from the old one.\n";
  243. }
  244. }while (passIn == currentmemberinfo.getuserpassword());
  245. currentmemberinfo.setuserpassword(passIn);
  246. for(int index = 0; index < databasesize; index++){
  247. if(database[index].getmembername() == currentmemberinfo.getmembername()){
  248. database[index] = currentmemberinfo;
  249. break;
  250. }
  251. }
  252. }
  253.  
  254. void admin::addnewmember(vector <member>& database) {
  255. member newmember;
  256. string nameIn;
  257. string passIn;
  258. int verifyIn;
  259.  
  260. cout << "Username: ";
  261. cin >> nameIn;
  262. newmember.setuserMemberInfo(nameIn);
  263. cout << "Password: ";
  264. cin >> passIn;
  265. newmember.setuserpassword(passIn);
  266. cout << "Role (1 - Administrator; 2 - Branch Staff): ";
  267. cin >> verifyIn;
  268. newmember.setverification(verifyIn);
  269. int index;
  270. for(index = 0; index < databasesize; index++){
  271. if(database[index].getverification() == 0){
  272. database[index] = newmember;
  273. if(newmember.getverification() == 1){
  274. cout << "User Name: " << nameIn << " Role: System Administrator\n";
  275. }
  276. else{
  277. cout << "User Name: " << nameIn << " Role: Branch Staff\n";
  278. }
  279. break;
  280. }
  281. else if(index == databasesize - 1 && database[index].getverification() != 0){
  282. cout << "We apologize. The database seems to be full\n";
  283. break;
  284. }
  285. }
  286. }
  287.  
  288. void admin::deletemember(vector <member>& database) {
  289. member empty_member;
  290. string nameIn;
  291. int choice;
  292.  
  293. cout << "Delete a user - User Name: ";
  294. cin >> nameIn;
  295. cout << "3) Confirm\n";
  296. cout << "4) Cancel\n";
  297. cout << "Please choose an option: ";
  298. cin >> choice;
  299. switch(choice){
  300. case 3:
  301. for(int index = 0; index < databasesize; index++){
  302. if(database[index].getmembername() == nameIn){
  303. database[index] = empty_member;
  304. cout << "User " << nameIn << " was deleted.\n";
  305. break;
  306. }
  307. else if(index == databasesize - 1){
  308. cout << "Error - User was not found in the system.\n";
  309. }
  310. }
  311.  
  312. break;
  313. case 4:
  314. break;
  315. }
  316. }
  317.  
  318. void admin::displaybranch(vector <member> database) {
  319. for (int index = 0; index < databasesize; index++) {
  320. if (database[index].getverification() != 0) {
  321. if (database[index].getverification() == 1) {
  322. cout << "User Name: " << database[index].getmembername() << " Role: Administrator\n";
  323. }
  324. else if(database[index].getverification() == 2){
  325. cout << "User Name: " << database[index].getmembername() << " Role: Branch Staff\n";
  326. }
  327. }
  328. }
  329. }
  330.  
  331. string member::getmembername() {
  332. return name;
  333. }
  334.  
  335. string member::getuserpassword() {
  336. return password;
  337. }
  338.  
  339. int member::getverification() {
  340. return verification;
  341. }
  342.  
  343. int account::getuserverification() {
  344. return verification;
  345. }
  346.  
  347. int client::getverification() {
  348. return getverification();
  349. }
  350.  
  351. void member::setverification(int verifyIn) {
  352. verification = verifyIn;
  353. }
  354.  
  355. void client::setverification(int verifyIn) {
  356. verification = verifyIn;
  357. }
  358.  
  359. void account::setuserverification(int verifyIn) {
  360. verification = verifyIn;
  361. }
  362.  
  363. void admin::setverify(int verifyIn) {
  364. verify = verifyIn;
  365. }
  366.  
  367. string admin::getadminname(string) {
  368. return name;
  369. }
  370.  
  371. string admin::getadminpass(string) {
  372. return password;
  373. }
  374.  
  375. void member::setuserMemberInfo(string nameIn){
  376. name = nameIn;
  377. }
  378.  
  379. void member::setuserpassword(string passwordIn){
  380. password = passwordIn;
  381. }
  382.  
  383. void member::changeuserpass(member currentmemberinfo, vector <member>& database) {
  384. string passIn;
  385. do{
  386. cout << "New Password: ";
  387. cin >> passIn;
  388. if (passIn == currentmemberinfo.getuserpassword()){
  389. cout << "Error - Your new password must be different from the old one.\n";
  390. }
  391. }while (passIn == currentmemberinfo.getuserpassword());
  392. currentmemberinfo.setuserpassword(passIn);
  393. for(int index = 0; index < databasesize; index++){
  394. if (database[index].getmembername() == currentmemberinfo.getmembername()){
  395. database[index] = currentmemberinfo;
  396. }
  397. }
  398. }
  399.  
  400. void menu::membermenu(){
  401. cout << "=============================================================\n";
  402. cout << "| Teller Terminal System – Branch Staff |\n";
  403. cout << "=============================================================\n";
  404. cout << "1) Client and Account Management\n";
  405. cout << "2) Change password\n";
  406. cout << "3) Exit\n";
  407. cout << "Please choose an option: ";
  408. }
  409.  
  410. void menu::showrequest() {
  411. cout << "=============================================================\n";
  412. cout << "| Teller Terminal System – Client and Account Management |\n";
  413. cout << "=============================================================\n";
  414. cout << "1) Add a client\n";
  415. cout << "2) Add an account\n";
  416. cout << "3) Edit Client Information\n";
  417. cout << "4) Manage an account\n";
  418. cout << "5) Save Client and Account Information\n";
  419. cout << "6) Exit\n";
  420. cout << "Please choose an option: ";
  421. }
  422.  
  423. void addclient(vector <client>& clientdatabase){
  424. string nameIn;
  425. string addressIn;
  426. int ssnIn;
  427. string employerIn;
  428. int incomeIn;
  429.  
  430. cout << "A new client will be added: \n";
  431. client newclient;
  432. cout << "Client name: ";
  433. cin >> nameIn;
  434. newclient.setuserclientname(nameIn);
  435. cout << "Address: ";
  436. cin >> addressIn;
  437. newclient.setuseraddress(addressIn);
  438. cout << "Social Security Number: ";
  439. cin >> ssnIn;
  440. newclient.setuserssninfo(ssnIn);
  441. cout << "Employer: ";
  442. cin >> employerIn;
  443. newclient.setuseremployerinfo(employerIn);
  444. cout << "Annual Income: ";
  445. cin >> incomeIn;
  446. newclient.setuserincomeinfo(incomeIn);
  447. for(int index = 0; index < databasesize; index++){
  448. if(clientdatabase[index].getverification() == 0){
  449. newclient.setverification(1);
  450. clientdatabase[index] = newclient;
  451. cout << "A new client was added!\n";
  452. break;
  453. }
  454. else if(index == databasesize - 1 && clientdatabase[index].getverification() != 0){
  455. "We apologize. The database seems to be full\n";
  456. break;
  457. }
  458. }
  459. }
  460.  
  461. void addaccount(vector <client>& clientdatabase, vector <account>& accountdatabase){
  462. string clientnameIn;
  463. int acctnumIn;
  464. string acctypeIn;
  465. int balanceIn;
  466.  
  467. cout << "Choose a client: ";
  468. cin >> clientnameIn;
  469. for(int index = 0; index < databasesize; index++){
  470. if(clientdatabase[index].getclientnameinfo() == clientnameIn){
  471. cout << "A new account will be created for " << clientdatabase[index].getclientnameinfo() << "....\n";
  472. account newaccount;
  473. newaccount.setuserverification(1);
  474. cout << "Account Number: ";
  475. cin >> acctnumIn;
  476. newaccount.setuseracctnum(acctnumIn);
  477. cout << "Account Type: ";
  478. cin >> acctypeIn;
  479. newaccount.setuseraccttype(acctypeIn);
  480. cout << "Balance: ";
  481. cin >> balanceIn;
  482. newaccount.setuseracctbalance(balanceIn);
  483. newaccount.setuseracctname(clientdatabase[index].getclientnameinfo());
  484. for(int num = 0; num < databasesize; num++){
  485. if(accountdatabase[num].getuserverification() == 0){
  486. accountdatabase[num] = newaccount;
  487. cout << "A new account was created for " << accountdatabase[index].getuseracctname() << " \n";
  488. break;
  489. }
  490. else if(index == databasesize - 1 && accountdatabase[index].getuserverification() != 0){
  491. "We apologize. The database seems to be full\n";
  492. break;
  493. }
  494. }
  495. break;
  496. }
  497. else if(index == databasesize - 1){
  498. cout << "Error - The client is not in the system.\n";
  499. }
  500. }
  501. }
  502.  
  503. void editclientinfo(vector <client>& clientdatabase){
  504. string clientnameIn;
  505. string newaddress;
  506. int newssn;
  507. string newemployer;
  508. int newannualincome;
  509. bool active = true;
  510.  
  511. int choice = 0;
  512.  
  513. cout << "Choose a client: ";
  514. cin >> clientnameIn;
  515. for(int index = 0; index < databasesize; index++){
  516. if(clientdatabase[index].getclientnameinfo() == clientnameIn){
  517. cout << "Display " << clientdatabase[index].getclientnameinfo() << "'s information: \n";
  518. cout << "Address: " << clientdatabase[index].getuseraddressinfo() << "\n";
  519. cout << "Social security number: " << clientdatabase[index].getuserssn() << "\n";
  520. cout << "Employer: " << clientdatabase[index].getuseremployer() << "\n";
  521. cout << "Annual Income: " << clientdatabase[index].getuserincome() << "\n";
  522. cout << "Client " << clientdatabase[index].getclientnameinfo() << "'s information will be updated...\n";
  523. cout << "1) Confirm\n";
  524. cout << "2) Cancel\n";
  525. cout << "Please choose an option: ";
  526. cin >> choice;
  527. switch(choice){
  528. case 1:
  529. cout << "Address: ";
  530. cin >> newaddress;
  531. clientdatabase[index].setuseraddress(newaddress);
  532. cout << "Social security number: ";
  533. cin >> newssn;
  534. clientdatabase[index].setuserssninfo(newssn);
  535. cout << "Employer: ";
  536. cin >> newemployer;
  537. clientdatabase[index].setuseremployerinfo(newemployer);
  538. cout << "Annual Income: ";
  539. cin >> newannualincome;
  540. clientdatabase[index].setuserincomeinfo(newannualincome);
  541. cout << "Client " << clientdatabase[index].getclientnameinfo() << "'s information was updated.\n";
  542. break;
  543. case 2:
  544. break;
  545. }
  546. break;
  547. }
  548. else if(index == databasesize - 1){
  549. cout << "Error - Account " << clientdatabase[index].getclientnameinfo() << " is not in the system.\n";
  550. }
  551. }
  552. }
  553.  
  554. void manaccount(vector <account>& accountdatabase){
  555. int acctnumIn = 0;
  556. int choice = 0;
  557. int depositIn = 0;
  558. int withdrawIn = 0;
  559. bool inservice = true;
  560.  
  561. cout << "Which account will be managed? ";
  562. cin >> acctnumIn;
  563. for(int num = 0; num < databasesize; num++){
  564. if(accountdatabase[num].getuseracctnum() == acctnumIn){
  565. do{
  566. cout << "Manage account " << accountdatabase[num].getuseracctnum() << " for " << accountdatabase[num].getuseracctnum() << "...\n";
  567. cout << "1) Deposit\n";
  568. cout << "2) Withdraw\n";
  569. cout << "3) Cancel\n";
  570. cout << "Please choose an option: ";
  571. cin >> choice;
  572. switch(choice){
  573. case 1:
  574. cout << "Deposit Amount: ";
  575. cin >> depositIn;
  576. accountdatabase[num].userdeposit(depositIn);
  577. cout << "Balance of account " << accountdatabase[num].getuseracctnum() << " is: " << accountdatabase[num].getuserbalance() << "\n";
  578. break;
  579. case 2:
  580. cout << "Withdraw Amount: ";
  581. cin >> withdrawIn;
  582. accountdatabase[num].userwithdraw(withdrawIn);
  583. cout << "Balance of account " << accountdatabase[num].getuseracctnum() << " is: " << accountdatabase[num].getuserbalance() << "\n";
  584.  
  585. break;
  586. case 3:
  587. inservice = false;
  588. break;
  589. }
  590. }while(inservice == true);
  591. break;
  592. }
  593. else if(num == databasesize - 1){
  594. cout << "Error - Account " << acctnumIn << " is not in the system.\n";
  595. }
  596. }
  597. }
  598.  
  599. void accountsaveinfo(account accountread){
  600. ofstream outFile;
  601.  
  602. outFile.open("account-info.txt",ios::app);
  603. outFile << "Account name: "<< accountread.getuseracctname() << endl;
  604. outFile << "Balance: " << accountread.getuserbalance() << endl;
  605. outFile << "Account Type: "<< accountread.getuseraccttype() << endl;
  606. outFile << "Account Number: " << accountread.getuseracctnum() << endl;
  607. outFile.close();
  608. cout << "account information has been saved in the account-info file." << endl;
  609. }
  610.  
  611. void clientsaveinfo(client clientread){
  612. ofstream outFile;
  613.  
  614. outFile.open("client-info.txt", ios::app);
  615. outFile << "Client name: "<< clientread.getclientnameinfo() << endl;
  616. outFile << "Address: " << clientread.getuseraddressinfo() << endl;
  617. outFile << "Employer: " << clientread.getuseremployer() << endl;
  618. outFile << "Annual Income: " << clientread.getuserincome() << endl;
  619. outFile << "Social Security Number: " << clientread.getuserssn() << endl;
  620. outFile.close();
  621. cout << "Client information has been saved in the client-info file" << endl;
  622. }
  623.  
  624. void systemquit(member staff){
  625. ofstream outfile;
  626.  
  627. outfile.open("staffmembers.txt");
  628. outfile << "Name: " << staff.getmembername() << endl;
  629. outfile << "Password: " << staff.getuserpassword() << endl;
  630. if(staff.getverification() == 1){
  631. outfile << "Role: Admin" << endl;
  632. }
  633. else if(staff.getverification() == 2){
  634. outfile << "Role: Branch Staff" << endl;
  635. }
  636. outfile.close();
  637. }
  638.  
  639. void account::setuseracctname(string nameIn) {
  640. name = nameIn;
  641. }
  642.  
  643. void account::setuseracctnum(int numIn) {
  644. useracctnum = numIn;
  645. }
  646.  
  647. void account::setuseracctbalance(int userbalanceIn) {
  648. userbalance = userbalanceIn;
  649. }
  650.  
  651. void account::userdeposit(int userdepositIn){
  652. userbalance += userdepositIn;
  653. }
  654.  
  655. void account::userwithdraw(int userwithdrawIn){
  656. if(userwithdrawIn > userbalance){
  657. cout << "Insufficient funds. Can not withdraw. ";
  658. }
  659. else{
  660. userbalance -= userwithdrawIn;
  661. }
  662. }
  663.  
  664. void account::setuseraccttype(string typeIn) {
  665. getuseraccttype() = typeIn;
  666. }
  667.  
  668. string account::getuseracctname() {
  669. return name;
  670. }
  671.  
  672. string account::getuseraccttype() {
  673. return useracctype;
  674. }
  675.  
  676. int account::getuserbalance() {
  677. return userbalance;
  678. }
  679.  
  680. int account::getuseracctnum() {
  681. return useracctnum;
  682. }
  683.  
  684. void client::setuseraddress(string addressIn) {
  685. useraddress = addressIn;
  686. }
  687.  
  688. void client::setuserclientname(string nameIn) {
  689. userclientname = nameIn;
  690. }
  691.  
  692. void client::setuseremployerinfo(string nameIn) {
  693. useremployerinfo = nameIn;
  694. }
  695.  
  696. void client::setuserincomeinfo(int userincomeIn) {
  697. userincomeinfo = userincomeIn;
  698. }
  699.  
  700. void client::setuserssninfo(int ssnIn) {
  701. userssninfo = ssnIn;
  702. }
  703.  
  704. string client::getuseraddressinfo() {
  705. return useraddress;
  706. }
  707.  
  708. string client::getclientnameinfo() {
  709. return userclientname;
  710. }
  711.  
  712. string client::getuseremployer() {
  713. return useremployerinfo;
  714. }
  715.  
  716. int client::getuserssn() {
  717. return userssninfo;
  718. }
  719.  
  720. int client::getuserincome() {
  721. return userincomeinfo;
  722. }
  723.  
  724. int main(){
  725. admin myadmin;
  726. member currentmemberinfo;
  727. member adminmember;
  728. vector <member> database(databasesize);
  729. vector <client> clientdatabase(databasesize);
  730. vector <account> accountdatabase(databasesize);
  731. adminmember.setuserMemberInfo("Jesufarahanmi");
  732. adminmember.setuserpassword("YungMacster");
  733. adminmember.setverification(1);
  734. database[0] = adminmember;
  735. menu Menu;
  736. string nameIn;
  737. string passIn;
  738. int userInput;
  739. char c;
  740. bool active = true;
  741. bool active1 = true;
  742. bool active2 = true;
  743. bool active3 = true;
  744. bool active4 = true;
  745.  
  746. do {
  747. active = true;
  748. Menu.seeMain();
  749. cout << "\tPlease choose an option: ";
  750. cin >> userInput;
  751. switch(userInput){
  752. case 1:
  753. Menu.seeuserlogin();
  754. for(int attempts = 0; attempts < 3; attempts++){
  755. cout << "User Name: ";
  756. cin >> nameIn;
  757. cout << "Password: ";
  758. cin >> passIn;
  759. if(!Menu.certification(nameIn, passIn, database)){
  760. cout << "The user name or password is incorrect. Try again.\n";
  761. }
  762. else{
  763. currentmemberinfo.setuserMemberInfo(Menu.returnmember(nameIn, passIn, database).getmembername());
  764. currentmemberinfo.setuserpassword(Menu.returnmember(nameIn, passIn, database).getuserpassword());
  765. currentmemberinfo.setverification(Menu.returnmember(nameIn, passIn, database).getverification());
  766. if(currentmemberinfo.getverification() == 1){
  767. do{
  768. int choice;
  769. Menu.showAdminMenu();
  770. cin >> choice;
  771. switch(choice){
  772. case 1:
  773. do{
  774. Menu.showrequest();
  775. int choice1 = 0;
  776. cin >> choice1;
  777. switch(choice1){
  778. case 1:
  779. addclient(clientdatabase);
  780. cout << "Press any key to continue...\n";
  781. cin.ignore().get();
  782. active3 = true;
  783. break;
  784. case 2:
  785. addaccount(clientdatabase, accountdatabase);
  786. cout << "Press any key to continue...\n";
  787. cin.ignore().get();
  788. active3 = true;
  789. break;
  790. case 3:
  791. editclientinfo(clientdatabase);
  792. cout << "Press any key to continue...\n";
  793. cin.ignore().get();
  794. active3 = true;
  795. break;
  796. case 4:
  797. manaccount(accountdatabase);
  798. active3 = true;
  799. break;
  800. case 5:
  801. for(int index = 0; index < databasesize; index++){
  802. if(clientdatabase[index].getverification() == 1){
  803. clientsaveinfo(clientdatabase[index]);
  804. }
  805. }
  806. for(int index = 0; index < databasesize; index++){
  807. if(accountdatabase[index].getuserverification() == 1){
  808. accountsaveinfo(accountdatabase[index]);
  809. }
  810. }
  811. cout << "Press any key to continue...\n";
  812. cin.ignore().get();
  813. active3 = true;
  814. break;
  815. case 6:
  816. active3 = false;
  817. break;
  818. default:
  819. break;
  820. }
  821. }while(active3);
  822. active1 = true;
  823. break;
  824. case 2:
  825. myadmin.addnewmember(database);
  826. cout << "Press any key to continue...\n";
  827. cin.ignore().get();
  828. active1 = true;
  829. break;
  830. case 3:
  831. myadmin.deletemember(database);
  832. cout << "Press any key to continue...\n";
  833. cin.ignore().get();
  834. active1 = true;
  835. break;
  836. case 4:
  837. myadmin.displaybranch(database);
  838. cout << "Press any key to continue...\n";
  839. cin.ignore().get();
  840. active1 = true;
  841. break;
  842. case 5:
  843. myadmin.changepassword(currentmemberinfo, database);
  844. cout << "Press any key to continue...\n";
  845. cin.ignore().get();
  846. active1 = true;
  847. break;
  848. case 6:
  849. active1 = false;
  850. break;
  851. default:
  852. break;
  853. }
  854. }while(active1);
  855. break;
  856. }
  857. else if(currentmemberinfo.getverification() == 2){
  858. do{
  859. int choice;
  860. Menu.membermenu();
  861. cin >> choice;
  862. switch(choice){
  863. case 1:
  864. do{
  865. Menu.showrequest();
  866. int choice2 = 0;
  867. cin >> choice2;
  868. switch(choice2){
  869. case 1:
  870. addclient(clientdatabase);
  871. cout << "Press any key to continue...\n";
  872. cin.ignore().get();
  873. active4 = true;
  874. break;
  875. case 2:
  876. addaccount(clientdatabase, accountdatabase);
  877. cout << "Press any key to continue...\n";
  878. cin.ignore().get();
  879. active4 = true;
  880. break;
  881. case 3:
  882. editclientinfo(clientdatabase);
  883. cout << "Press any key to continue...\n";
  884. cin.ignore().get();
  885. active4 = true;
  886. break;
  887. case 4:
  888. manaccount(accountdatabase);
  889. active4 = true;
  890. break;
  891. case 5:
  892. for(int index = 0; index < databasesize; index++){
  893. if(clientdatabase[index].getverification() == 1){
  894. clientsaveinfo(clientdatabase[index]);
  895. }
  896. }
  897. for(int index = 0; index < databasesize; index++){
  898. if(accountdatabase[index].getuserverification() == 1){
  899. accountsaveinfo(accountdatabase[index]);
  900. }
  901. }
  902. cout << "Press any key to continue...\n";
  903. cin.ignore().get();
  904. active4 = true;
  905. break;
  906. case 6:
  907. active4 = false;
  908. default:
  909. break;
  910. }
  911. }while(active4);
  912. active2 = true;
  913. break;
  914. case 2:
  915. currentmemberinfo.changeuserpass(currentmemberinfo, database);
  916. cout << "Press any key to continue...\n";
  917. cin.ignore().get();
  918. active2 = true;
  919. break;
  920. case 3:
  921. active2 = false;
  922. break;
  923. default:
  924. break;
  925. }
  926. }while(active2);
  927. }
  928. break;
  929. }
  930. }
  931. active = true;
  932. break;
  933. case 2:
  934. for(int index = 0; index < databasesize; index++){
  935. if(database[index].getverification() > 0 && database[index].getverification() <= 2){
  936. systemquit(database[index]);
  937. }
  938. }
  939. cout << "Press any key to continue...\n";
  940. cin.ignore().get();
  941. active = false;
  942. break;
  943. default:
  944. break;
  945. }
  946. }while(active);
  947. return 0;
  948. }
Add Comment
Please, Sign In to add comment