Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.51 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <fstream>
  4. #include <vector>
  5. #include <stdlib.h>
  6.  
  7. using namespace std;
  8.  
  9.  
  10. class Client{
  11. public:
  12. Client(int, string, string, string, string, double);
  13. void addAccount(float accountNum, string accType, float balance);
  14. string getName();
  15. string getEmployer();
  16. string getAddress();
  17. string getSSN();
  18. double getIncome();
  19. void setName(string newName);
  20. void setEmployer(string newEmployer);
  21. void setAddress(string newAddress);
  22. void setSSN(string newSSN);
  23. void setIncome(double newIncome);
  24. int getID();
  25. private:
  26. double income;
  27. int clientID;
  28. string name, employer, address, ssn;
  29. };
  30.  
  31. class ClientVector
  32. {
  33. public:
  34. void addClient(Client inClient);
  35. vector<Client> clientList;
  36. void readIn();
  37. ClientVector();
  38. int idCounter;
  39. };
  40.  
  41. class Account{
  42. public:
  43. int getAcctNum();
  44. int getType();
  45. string getOwner();
  46. Account(int, int, string, int, double);
  47. void changeBalance(double);
  48. private:
  49. int acctNum;
  50. int ownerNum;
  51. string owner;
  52. int type;
  53. double balance;
  54. };
  55.  
  56. class AccountVector
  57. {
  58. public:
  59. vector<Account> accountList;
  60. AccountVector();
  61. void readIn();
  62. void AddAccount(string, float, int, double);
  63. };
  64.  
  65. class Password
  66. {
  67. private:
  68. string passw;
  69. public:
  70. bool operator ==(const Password&) const;
  71. bool operator ==(const string&) const;
  72. Password();
  73. Password(string);
  74. bool changePass();
  75.  
  76. };
  77.  
  78. class Staff{
  79. public:
  80. string getName();
  81. bool authenticate(string pass);
  82. Staff(string, string, bool);
  83. bool admin;
  84. bool changePass();
  85. string staffOut();
  86. private:
  87. string name;
  88. Password password;
  89. };
  90.  
  91. class StaffVector
  92. {
  93. public:
  94. vector<Staff> staffList;
  95. StaffVector();
  96. void addStaff(string, string, bool);
  97. void readIn();
  98. void writeOut();
  99. };
  100.  
  101.  
  102. class staffMenu{
  103. public:
  104. staffMenu(Staff);
  105. staffMenu(int);
  106. ClientVector addClient(ClientVector);
  107. StaffVector changePass(StaffVector);
  108. ClientVector changeInfo(ClientVector);
  109. AccountVector manageAccount(AccountVector);
  110. private:
  111. int selection;
  112. };
  113. AccountVector staffMenu::manageAccount(AccountVector acIN)
  114. {
  115. AccountVector accountList = acIN;
  116. ClientVector clientList;
  117. int accountChoice;
  118. int choice;
  119. cout<<"Whice account will be managed?";
  120. cin>>accountChoice;
  121. for(int i = 0; i < accountList.accountList.size();i++)
  122. {
  123.  
  124. if(accountChoice == accountList.accountList[i].getAcctNum())
  125. {
  126. while(true)
  127. {
  128. cout<<"Manage accout "<<accountChoice<<" for "<<accountList.accountList[i].getOwner()<<"..."<<endl;
  129. cout<<"1) Deposit"<<endl;
  130. cout<<"2) Withdraw"<<endl;
  131. cout<<"3) Cancel"<<endl;
  132. cout<<"Please choose an option";
  133. cin>>choice;
  134. switch(choice)
  135. {
  136. case 1:
  137.  
  138. double deposit;
  139. cout<<"Deposit Amount: ";
  140. cin>>deposit;
  141. if(cin.good())
  142.  
  143. accountList.accountList[i].changeBalance(deposit);// += deposit;
  144. break;
  145. case 2:
  146. double withdrawal;
  147. cout<<"Withdrawal Amount: ";
  148. cin>>withdrawal;
  149. withdrawal = 0 - withdrawal;
  150. accountList.accountList[i].changeBalance(withdrawal);// += deposit;
  151.  
  152. //do with withdrawal
  153. break;
  154. case 3:
  155. return accountList;
  156. }
  157. }
  158. }
  159. }
  160. }
  161.  
  162.  
  163. class Login
  164. {
  165. public:
  166. Login(StaffVector);
  167. string getName();
  168. bool changePass(string old1, string old2, string newpass);
  169. private:
  170. string password, name;
  171. bool admin;
  172. };
  173. void Account::changeBalance(double amount)
  174. {
  175. balance += amount;
  176. if(amount > balance)
  177. {balance -= 38;} //overdraft fee
  178. }
  179.  
  180. class adminMenu{
  181. public:
  182. void displayBranchStaff();
  183. StaffVector addStaff(StaffVector);
  184. StaffVector deleteStaff(StaffVector);
  185. void accessStaffMenu(int);
  186. adminMenu();
  187. private:
  188. int selection;
  189. };
  190. Password::Password()
  191. {
  192. }
  193. Password::Password(string passIN)
  194. {
  195. passw = passIN;
  196. }
  197. adminMenu::adminMenu()
  198. {
  199. StaffVector listOfStaff;
  200. listOfStaff.readIn();
  201. int option = 0;
  202. while(true)
  203. {
  204. cout<<"========================================================"<<endl;
  205. cout<<" Teller Terminal System – System Administration "<<endl;
  206. cout<<"========================================================"<<endl;
  207. cout<<"1) Add a branch staff member"<<endl;
  208. cout<<"2) Delete a branch staff member"<<endl;
  209. cout<<"3) Display branch staff"<<endl;
  210. cout<<"4) Client and Account Management"<<endl;
  211. cout <<"5) Change password" << endl;
  212. cout<<"6) Exit"<<endl;
  213. cout<<endl;
  214. cout<<"Please choose an option:";
  215. cin>>option;
  216. switch(option)
  217. {
  218. case 1:
  219. {
  220. listOfStaff = addStaff(listOfStaff);
  221. break;
  222. }
  223. case 2:
  224. {
  225. listOfStaff = deleteStaff(listOfStaff);
  226. break;
  227. }
  228. case 3:
  229. {
  230. break;
  231. }
  232. case 4:
  233. {
  234. accessStaffMenu(4);
  235. break;
  236. }
  237. case 5:
  238. {
  239. accessStaffMenu(5);
  240. break;
  241. }
  242. case 6:
  243. {
  244. exit(0);
  245. }
  246. default:
  247. {
  248. cout<<"Invalid input, please try again\n";
  249. }
  250. }
  251.  
  252. cout<<endl;
  253. }
  254. }
  255. void adminMenu::accessStaffMenu(int selection)
  256. {
  257. staffMenu adminAccess = staffMenu(selection);
  258. }
  259.  
  260. StaffVector adminMenu::addStaff(StaffVector svIN)
  261. {
  262. cout<<"Add a staff member\n";
  263. StaffVector staffList = svIN;
  264. string nameEntry, passwordEntry;
  265. bool adminEntry;
  266. cout<<"User Name: ";
  267. // getline (cin,nameEntry);
  268. cin>>nameEntry;// .ignore();
  269. cout<<endl;
  270. cout<<"Password: ";
  271. // getline (cin,passwordEntry);
  272. cin>>passwordEntry;//.ignore();
  273. cout<<endl;
  274. cout<<"Role (1 - Administrator; 0 - Branch Staff): ";
  275. cin>>adminEntry;
  276. if((adminEntry == 0) || (adminEntry == 1))
  277. {
  278. Staff staffEntry = Staff(nameEntry,passwordEntry,adminEntry);
  279. staffList.staffList.push_back(staffEntry);
  280. }
  281. else
  282. {
  283. while((adminEntry != 0) && (adminEntry != 1))
  284. {
  285. cout<<"invalid staff type, please try again:";
  286. cin>>adminEntry;
  287. }
  288. Staff staffEntry = Staff(nameEntry,passwordEntry,adminEntry);
  289. staffList.staffList.push_back(staffEntry);
  290.  
  291. }
  292. return staffList;
  293.  
  294. }
  295. void adminMenu::displayBranchStaff()
  296. {
  297. StaffVector staffList;
  298. cout<<"There are "<<staffList.staffList.size()<<" users in the system."<<endl;
  299. // for(int i = 0; staffList.staffList.size(); i++)
  300. // {
  301. // cout<<
  302. //
  303. // }
  304.  
  305. }
  306. StaffVector adminMenu::deleteStaff(StaffVector svIN)
  307. {
  308. int option;
  309. StaffVector listOfStaff = svIN;
  310. string userToDelete;
  311. cout<<"Delete a user - User Name: ";
  312. cin>>userToDelete;
  313. cout<<"1) Confirm\n";
  314. cout<<"2) Cancel\n";
  315. cin>>option;
  316. switch(option)
  317. {
  318. case 1:
  319. {
  320. bool nothere = true;
  321. for(int i = 0; i < listOfStaff.staffList.size(); i++)
  322. {
  323. if(userToDelete == listOfStaff.staffList[i].getName())
  324. {
  325. listOfStaff.staffList.erase(listOfStaff.staffList.begin()+i-1);
  326. cout<<"User "<<userToDelete<<" was deleted!\n";
  327. nothere = false;
  328. }
  329. }
  330. if(nothere)cout<<"Warning - User "<<userToDelete<<" is not in the system. No user is deleted!\n";
  331. break;
  332. }
  333.  
  334. case 2:
  335. break;
  336. }
  337. return listOfStaff;
  338. }
  339.  
  340. int main()
  341. {
  342.  
  343.  
  344. {
  345. //TEST STUFF
  346. // ClientVector clientList;
  347. // clientList.readIn();
  348. // AccountVector accountList;
  349. // accountList.readIn();
  350. StaffVector staffList;
  351. staffList.readIn();
  352. Login test = Login(staffList);
  353. // clientList = test.changeInfo(clientList);
  354. // for(int i = 0; i < clientList.clientList.size(); i++)
  355. // {
  356. // cout << clientList.clientList[i].getID() << endl;
  357. // }
  358.  
  359. // ClientVector test = ClientVector();
  360. // for(int i = 0; i < test.clientList.size(); i++)
  361. // {
  362. // cout << test.clientList[i].getID() << endl;
  363. // }
  364. // cout << "now for accounts" << endl;
  365. // AccountVector test2 = AccountVector();
  366. // for(int j = 0; j < test2.accountList.size(); j++)
  367. // {
  368. // cout << test2.accountList[j].getAcctNum() << endl;
  369. // }
  370. // cout << "now for staff" << endl;
  371. // StaffVector test3 = StaffVector();
  372. // for(int k = 0; k < test3.staffList.size(); k++)
  373. // {
  374. // cout << test3.staffList[k].getName() << endl;
  375. // }
  376. }
  377. return 0;
  378. }
  379.  
  380. bool Password::operator ==(const string &passwIN) const
  381. {
  382. return (passw == passwIN);
  383. }
  384. bool Password::changePass()
  385. {
  386.  
  387. // string newPass;
  388. // cout <<"Please input current password: ";
  389. // cin>>newPass;
  390.  
  391. }
  392.  
  393. Login::Login(StaffVector svIN)
  394. {
  395. StaffVector staffList = svIN;
  396. string userName;
  397. int option = 0;
  398. string passwordTry;
  399. cout<<"========================================================"<<endl;
  400. cout<<" Welcome to the Auburn Branch of the Tiger Bank "<<endl;
  401. cout<<"========================================================"<<endl;
  402. cout<<"1)Login"<<endl;
  403. cout<<"2)Quit"<<endl;
  404. cout<<endl;
  405. cout<<"Please choose an option:";
  406. cin>>option;
  407. cout<<endl;
  408. switch(option)
  409. {
  410. case 1:
  411. cout<<"========================================================"<<endl;
  412. cout<<" Login to Access the Teller Terminal System "<<endl;
  413. cout<<"========================================================"<<endl;
  414. while(true)
  415. {
  416. cout<<endl;
  417. cout<<"UserName:";
  418. cin>>userName;
  419. cout<<"Password:";
  420. cin>>passwordTry;
  421.  
  422. for(int i = 0; i < staffList.staffList.size(); i++)
  423. {
  424. cout << i << endl;
  425. if((userName == staffList.staffList[i].getName()) &&
  426. (staffList.staffList[i].authenticate(passwordTry)))
  427. {
  428. if(staffList.staffList[i].admin)
  429. {
  430. adminMenu aMenu;
  431. }
  432.  
  433. else
  434. staffMenu sMenu = staffMenu(staffList.staffList[i]);
  435.  
  436. }
  437. else
  438. {
  439. cout<<"invalid username or password, try again: ";
  440. }
  441.  
  442. }
  443.  
  444. }
  445.  
  446.  
  447. case 2:
  448. break;
  449.  
  450. }
  451. }
  452.  
  453.  
  454. staffMenu::staffMenu(Staff loggedIn)
  455. {
  456.  
  457. int option = 0;
  458. int manageOption = 0;
  459. while(true)
  460. {
  461. cout<<"========================================================"<<endl;
  462. cout<<" Teller Terminal System – Branch Staff "<<endl;
  463. cout<<"========================================================"<<endl;
  464.  
  465. cout<<"1) Client and Account Management"<<endl;
  466. cout <<"2) Change password" << endl;
  467. cout<<"3) Exit"<<endl;
  468. cout<<endl;
  469. cout<<"Please choose an option:" ;
  470. cin >> option;
  471. switch(option)
  472. {
  473. case 1:
  474. {
  475. cout<<"========================================================"<<endl;
  476. cout<<" Teller Terminal System – Client and Account Management "<<endl;
  477. cout<<"========================================================"<<endl;
  478. ClientVector listOfClients;
  479. listOfClients.readIn();
  480. AccountVector listofAccts;
  481. listofAccts.readIn();
  482. bool loop = true;
  483. while(loop)
  484. {
  485. cout <<"1) Add a client"<<endl;
  486. cout<<"2) Add an account"<<endl;
  487. cout<<"3) Edit Client Information"<<endl;
  488. cout<<"4) Manage an account"<<endl;
  489. cout<<"5) Save Client and Account Information"<<endl;
  490. cout<<"6) Exit"<<endl;
  491. cout<<"Please choose an option: ";
  492. cin>>manageOption;
  493. switch(manageOption)
  494. {
  495. case 1:
  496. {
  497. listOfClients = addClient(listOfClients);
  498. break;
  499. }
  500. case 2:
  501. {
  502. cout<<"Temoporalily unavailable, sorry for the innconvience\n";
  503. break;
  504. }
  505. case 3:
  506. {
  507. listOfClients = changeInfo(listOfClients);
  508. break;
  509. }
  510. case 4:
  511. {
  512. listofAccts = manageAccount(listofAccts);
  513. break;
  514. }
  515. case 5:
  516. {
  517. listofAccts = manageAccount(listofAccts);
  518. break;
  519. }
  520. case 6:
  521. {
  522. loop = false;
  523. break;
  524. }
  525. }
  526.  
  527.  
  528.  
  529.  
  530. }
  531.  
  532. break;
  533. }
  534. case 2:
  535. {
  536. loggedIn.changePass();
  537. break;
  538. }
  539. case 3:
  540. {
  541. exit(0);
  542. }
  543. default:
  544. {
  545. cout<<"Invalid selection.\n";
  546. }
  547. }
  548. }
  549. }
  550. ClientVector staffMenu::addClient(ClientVector cvIN)//(string name, string address, float ssn, string employer, float income)
  551. {
  552.  
  553. ClientVector clientList = cvIN;
  554. string nameEntry;
  555. string addressEntry;
  556. string employerEntry;
  557. string ssnEntry;
  558. double incomeEntry;
  559. cout<<"A new client will be added:"<<endl;
  560. cout<<"Client name:";
  561. getline(cin,nameEntry);
  562. cin.ignore();
  563. cout<<"Address:";
  564. getline(cin,addressEntry);
  565. cin.ignore();
  566. cout<<"Social security number:";
  567. getline(cin,ssnEntry);
  568. cin.ignore();
  569. cout<<"Employer:";
  570. getline(cin,employerEntry);
  571. cin.ignore();
  572. cout<<"Annual income:";
  573. cin>>incomeEntry;
  574. cout<<endl;
  575. cout<<"A new client was added!";
  576. cout<<endl;
  577. Client clientEntry = Client(clientList.idCounter,nameEntry, addressEntry, ssnEntry, employerEntry, incomeEntry);
  578. clientList.clientList.push_back(clientEntry);
  579. clientList.idCounter++;
  580. return clientList;
  581. }
  582. ClientVector staffMenu::changeInfo(ClientVector cvIN)
  583. {
  584. string nameEntry;
  585. string addressEntry;
  586. string employerEntry;
  587.  
  588. string ssnEntry;
  589. double incomeEntry;
  590. int option;
  591. ClientVector clientList = cvIN;
  592. string clientName;
  593. cout<<"Choose a client: ";
  594. getline (cin,clientName);
  595. // cout<<clientName << clientList.clientList.size();
  596. for(int i = 0; i < clientList.clientList.size(); i++)
  597. {
  598. cout<<endl;
  599. cout<<"Checking for client "<<endl;; //<< clientList.clientList[0].getName() << endl;
  600. if((clientName == clientList.clientList[i].getName()))
  601. {
  602.  
  603. cout<<"Display "<<clientName<<"\'s information:"<<endl;
  604. cout<<"Address: "<<clientList.clientList[i].getAddress()<<endl;
  605. cout<<"Social Security Number: "<<clientList.clientList[i].getSSN()<<endl;
  606. cout<<"Employer: "<<clientList.clientList[i].getEmployer()<<endl;
  607. cout<<"Annual Income: "<<clientList.clientList[i].getIncome()<<endl;
  608. cout<<"Client "<<clientName<<"\'s information will be updated..."<<endl;
  609. cout<<"1) Confirm"<<endl;
  610. cout<<"2) Cancel" <<endl;
  611. while(true)
  612. {
  613. cout<<"Please choose an option (option 1 is confirm information, option 2 is cancel and go back to the menu): "<<endl;
  614. cin>>option;
  615. // cin.ignore();
  616. switch(option){
  617. case 1:
  618. cout<< "Confirm client information: \n";
  619. cout<<"Address: ";
  620. getline(cin,addressEntry);
  621. cin.ignore();
  622. cout<<endl;
  623. cout<<"Social security number: ";
  624. getline(cin,ssnEntry);
  625. cin.ignore();
  626. cout<<endl;
  627. cout<<"Employer: ";
  628. getline(cin,employerEntry);
  629. cin.ignore();
  630. cout<<"Annual income: ";
  631. cin>>incomeEntry;
  632. cout<<endl;
  633.  
  634.  
  635. cout << "address " << addressEntry << endl;
  636. cout << "SSN " << ssnEntry << endl;
  637. cout << "employer " <<employerEntry << endl;
  638. cout << "income " << incomeEntry << endl;
  639.  
  640. clientList.clientList[i].setAddress(addressEntry);
  641. clientList.clientList[i].setSSN(ssnEntry);
  642. clientList.clientList[i].setEmployer(employerEntry);
  643. clientList.clientList[i].setIncome(incomeEntry);
  644. break;
  645. case 2:
  646. return clientList;
  647. default:
  648. cout<<"Invalid Choice"<<endl;
  649.  
  650. }
  651. }
  652. }
  653.  
  654.  
  655. }
  656. cout<<"User Name: "<<clientName<<" is not on file"<<endl;
  657. return clientList;
  658. }
  659.  
  660. Account::Account(int acctNumIN, int ownerNumIN, string ownerIN, int typeIN, double balanceIN)
  661. {
  662. acctNum = acctNumIN;
  663. ownerNum = ownerNumIN;
  664. owner = ownerIN;
  665. type = typeIN;
  666. balance = balanceIN;
  667. }
  668.  
  669. int Account::getAcctNum()
  670. {
  671. return acctNum;
  672. }
  673. string Account::getOwner()
  674. {
  675. return owner;
  676. }
  677. AccountVector::AccountVector()
  678. {
  679. }
  680. void AccountVector::readIn()
  681. {
  682. ifstream file;
  683. file.open("account-info.txt");
  684. if(file.fail())
  685. {
  686. exit(1);
  687. }
  688. char charAcctNum[20], charOwnerNum[20], inOwner[20], charType[5], charBalance[20];
  689. int inAcctNum, inOwnerNum, inType;
  690. double inBalance;
  691. file.ignore(50, '\r');
  692. while (!file.eof())
  693. {
  694. file.getline(charAcctNum, 20, '\t');
  695. inAcctNum = atoi(charAcctNum);
  696. file.getline(charOwnerNum, 20, '\t');
  697. inOwnerNum = atoi(charOwnerNum);
  698. file.getline(inOwner, 20, '\t');
  699. file.getline(charType, 5, '\t');
  700. inType = atoi(charType);
  701. file.getline(charBalance, 20, '\r');
  702. inBalance = atof(charBalance);
  703. Account accountEntry = Account(inAcctNum, inOwnerNum, inOwner, inType, inBalance);
  704. accountList.push_back(accountEntry);
  705. }
  706. cout << "remember to error check against pre-existing account numbers \n";
  707. file.close();
  708.  
  709. }
  710.  
  711. void ClientVector::readIn()
  712. {
  713. ifstream file;
  714. file.open("client-info.txt");
  715. if(file.fail())
  716. {
  717. exit(1);
  718. }
  719.  
  720. char charClientID[12], inName[20], inSsn[12], inEmployer[50], charIncome[16], inAddress[50];
  721. double inIncome;
  722. int inClientID;
  723. file.ignore(50, '\r');
  724. while (!file.eof())
  725. {
  726. file.getline(charClientID, 50, '\t');
  727. inClientID = atoi(charClientID);
  728. file.getline(inName, 50, '\t');
  729. file.getline(inAddress, 50, '\t');
  730. file.getline(inSsn, 12, '\t');
  731. file.getline(inEmployer, 50, '\t');
  732. file.getline(charIncome, 15, '\r');
  733. inIncome = atof(charIncome);
  734. Client clientEntry = Client(inClientID, inName, inAddress, inSsn, inEmployer, inIncome);
  735. clientList.push_back(clientEntry);
  736. idCounter++;
  737. }
  738. cout << "remember to error check against pre-existing Client names \n";
  739. file.close();
  740.  
  741. }
  742.  
  743. ClientVector::ClientVector()
  744. {
  745. idCounter = 1;
  746. }
  747. void Client::addAccount(float accountNum, string accType, float balance)
  748. {
  749.  
  750.  
  751. }
  752.  
  753. int Client::getID()
  754. {
  755. return clientID;
  756. }
  757. string Client::getAddress()
  758. {
  759. return address;
  760. }
  761. void Client::setAddress(string newAddress)
  762. {
  763. address = newAddress;
  764. }
  765. void Client::setEmployer(string newEmployer)
  766. {
  767. employer = newEmployer;
  768. }
  769. void Client::setSSN(string newSSN)
  770. {
  771. ssn = newSSN;
  772. }
  773. void Client::setIncome(double newIncome)
  774. {
  775. income = newIncome;
  776. }
  777. string Client::getEmployer()
  778. {
  779. return employer;
  780. }
  781. string Client::getName()
  782. {
  783. return name;
  784. }
  785. string Client::getSSN()
  786. {
  787. return ssn;
  788. }
  789. double Client::getIncome()
  790. {
  791. return income;
  792. }
  793. Client::Client(int newID, string newName, string newAddress, string newSsn, string newEmployer, double newIncome)
  794. {
  795. clientID = newID;
  796. name = newName;
  797. address = newAddress;
  798. ssn = newSsn;
  799. employer = newEmployer;
  800. income = newIncome;
  801. }
  802.  
  803. bool Staff::authenticate(string passIN)
  804. {
  805. return(password == passIN);
  806. }
  807.  
  808. bool Staff::changePass()
  809. {
  810. string currentPass, newPass1, newPass2;
  811. cout <<"Please input current password: ";
  812. cin>>currentPass;
  813. cout<<endl;
  814.  
  815. if(authenticate(currentPass))
  816. {
  817. cout <<"Please input new password: ";
  818. cin>>newPass1;
  819. cout<<endl;
  820. cout <<"Please input new password again: ";
  821. cin>>newPass2;
  822. }
  823.  
  824. return true;
  825. }
  826. string Staff::staffOut()
  827. {
  828. string out1, out2, out3, out4, out;
  829. out1 = name;
  830. out2= '\t';
  831. out3 = admin;
  832. out4='\n';
  833. out = out1+out2+out3+out4;
  834. return out;
  835. }
  836.  
  837. Staff::Staff(string nameIN, string passwordIN, bool adminIN)
  838. {
  839. name = nameIN;
  840. password = passwordIN;
  841. admin = adminIN;
  842. }
  843. string Staff::getName()
  844. {
  845. return name;
  846. }
  847. StaffVector::StaffVector()
  848. {
  849. }
  850. void StaffVector::readIn()
  851. {
  852. ifstream file;
  853. file.open("staff.txt");
  854. if(file.fail())
  855. {
  856. exit(1);
  857. }
  858. char inName[20], inPassword[28], charAdmin[2];
  859. int inAdmin;
  860. file.ignore(50, '\r');
  861. while (!file.eof())
  862. {
  863. file.getline(inName, 19, '\t');
  864. file.getline(inPassword, 27, '\t');
  865. file.getline(charAdmin, 2, '\r');
  866. inAdmin = atoi(charAdmin);
  867. Staff staffEntry = Staff(inName, inPassword, inAdmin);
  868. staffList.push_back(staffEntry);
  869. }
  870. cout << "remember to error check against pre-existing staff \n";
  871. file.close();
  872.  
  873. }
  874. staffMenu::staffMenu(int option)
  875. {
  876. switch(option)
  877. {
  878. case 4:
  879. {
  880. cout<<"========================================================"<<endl;
  881. cout<<" Teller Terminal System – Client and Account Management "<<endl;
  882. cout<<"========================================================"<<endl;
  883. ClientVector listOfClients;
  884. listOfClients.readIn();
  885. AccountVector listofAccts;
  886. listofAccts.readIn();
  887. int manageOption;
  888. bool loop = true;
  889. while(loop)
  890. {
  891. cout <<"1) Add a client"<<endl;
  892. cout<<"2) Add an account"<<endl;
  893. cout<<"3) Edit Client Information"<<endl;
  894. cout<<"4) Manage an account"<<endl;
  895. cout<<"5) Save Client and Account Information"<<endl;
  896. cout<<"6) Exit"<<endl;
  897. cout<<"Please choose an option: ";
  898. cin>>manageOption;
  899. switch(manageOption)
  900. {
  901. case 1:
  902. {
  903. listOfClients = addClient(listOfClients);
  904. break;
  905. }
  906. case 2:
  907. {
  908. cout<<"Temoporalily unavailable, sorry for the innconvience\n";
  909. break;
  910. }
  911. case 3:
  912. {
  913. listOfClients = changeInfo(listOfClients);
  914. break;
  915. }
  916. case 4:
  917. {
  918. listofAccts = manageAccount(listofAccts);
  919. break;
  920. }
  921. case 5:
  922. {
  923. listofAccts = manageAccount(listofAccts);
  924. break;
  925. }
  926. case 6:
  927. {
  928. loop = false;
  929. break;
  930. }
  931. }
  932.  
  933.  
  934.  
  935.  
  936. }
  937. }
  938. case 5:
  939. {
  940.  
  941. break;
  942. }
  943. }
  944.  
  945. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement