Advertisement
Guest User

Untitled

a guest
Jun 21st, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.23 KB | None | 0 0
  1. #include <iostream> //Includes the Input/Output Framework
  2. #include <string> //Includes the String Framework to Allow the use of String Variables
  3. using namespace std;
  4.  
  5. int bookingNumber; //Variable Declared
  6. int main();
  7. string firstName = "None", lastName = "None", fullName = "None", emailAddress = "None", contactNumber = "None", itemType = "None", itemMake = "None", itemModel = "None", deviceError = "None", elaborate = "None"; //Global Variables for the booking systems, so that they can be used in different functions
  8.  
  9. /*Void Functions used as banners for program formatting*/
  10. void welcomeBanner()
  11. {
  12. system("cls");
  13. cout << "-----------------------" << endl;
  14. cout << "- Tech-IT Application -" << endl;
  15. cout << "-----------------------" << endl;
  16. }
  17.  
  18. void helpBanner()
  19. {
  20. system("cls");
  21. cout << "---------------------" << endl;
  22. cout << "- Tech-IT Help Page -" << endl;
  23. cout << "---------------------" << endl;
  24. }
  25.  
  26. void bookingBanner()
  27. {
  28. system("cls");
  29. cout << "-----------------------" << endl;
  30. cout << "- Tech-IT New Booking -" << endl;
  31. cout << "-----------------------" << endl;
  32. }
  33. void previousBanner()
  34. {
  35. system("cls");
  36. cout << "-----------------------------" << endl;
  37. cout << "Tech-IT Previous Bookings" << endl;
  38. cout << "-----------------------------" << endl;
  39. }
  40.  
  41. void choiceBanner()
  42. {
  43. cout << "-----------------------------" << endl;
  44. cout << "Enter your preferred choice: ";
  45. }
  46.  
  47. int help() /*Program Help Function*/
  48. {
  49. /*Two LOCAL Variables decalred for the goback and switch*/
  50. int choice;
  51. char goback, choice1, choice2, choice3, choice4, choice5, choice6, choice7;
  52.  
  53. goback: //Declaration for where the goback statement will be looped to
  54. helpBanner();//Calls helpBanner function
  55. /*Outputs onto the CLI a Help menu*/
  56. cout << "" << endl;
  57. cout << "1. How TO: Add a new record" << endl;
  58. cout << "2. How TO: View Previous Record" << endl;
  59. cout << "3. How TO: Clear Previous Record" << endl;
  60. cout << "4. Go Back: Main Application" << endl;
  61. cout << "" << endl;
  62. choiceBanner();//Calls choiceBanner function
  63. cin >> choice;//Allows user input for their specific choice from the menu
  64. switch (choice)//Initializes the switch choice statment
  65. {
  66. /*First SWITCH Case, where user will get help on how to add a new record.*/
  67. case 1:
  68. {
  69. helpBanner();
  70. cout << "" << endl;
  71. cout << "You have chosen..." << endl;
  72. cout << "How TO: Add a new record" << endl;
  73. cout << "" << endl;
  74. cout << "Step 1" << endl;
  75. cout << "- To add a new record you will have to select option 1 on the main page." << endl;
  76. cout << "" << endl;
  77. cout << "Would you like to continue to the next step? (Y/N)" << endl;
  78. choiceBanner();
  79. cin >> choice1;
  80. switch (choice1)
  81. {
  82. case 'Y': case 'y':
  83. {
  84. welcomeBanner();
  85. cout << "Step 2" << endl;
  86. cout << "- Once you have selected that option, you will then be displayed with a disclaimer." << endl;
  87. cout << "" << endl;
  88. cout << "Would you like to continue to the next step? (Y/N)" << endl;
  89. choiceBanner();
  90. cin >> choice2;
  91. switch (choice2)
  92. {
  93. case 'Y': case 'y':
  94. {
  95. welcomeBanner();
  96. cout << "Step 3" << endl;
  97. cout << "- After this disclaimer has been agreed to..." << endl;
  98. cout << "you will then have the ability to add a new record" << endl;
  99. cout << "" << endl;
  100. cout << "Would you like to continue to the next step? (Y/N)" << endl;
  101. choiceBanner();
  102. cin >> choice3;
  103. switch (choice3)
  104. {
  105. case 'Y': case 'y':
  106. {
  107. welcomeBanner();
  108. cout << "Step 4" << endl;
  109. cout << "- The first information the new record will take is personal information.\n-First Name\n-Last Name" << endl;
  110. cout << "" << endl;
  111. cout << "Would you like to continue to the next step? (Y/N)" << endl;
  112. choiceBanner();
  113. cin >> choice4;
  114. switch (choice4)
  115. {
  116. case 'Y': case 'y':
  117. {
  118. welcomeBanner();
  119. cout << "Step 5" << endl;
  120. cout << "- Once this information has been inputted by the user..." << endl;
  121. cout << "the user will have to confirm the information is correct." << endl;
  122. cout << "" << endl;
  123. cout << "Would you like to continue to the next step? (Y/N)" << endl;
  124. choiceBanner();
  125. cin >> choice5;
  126. switch (choice5)
  127. {
  128. case 'Y': case 'y':
  129. {
  130. welcomeBanner();
  131. cout << "Step 6" << endl;
  132. cout << "- This process will repeat for: \n-Contact Information \n-Device Information \n-Problem Information." << endl;
  133. cout << "" << endl;
  134. cout << "Would you like to continue? (Y/N)" << endl;
  135. choiceBanner();
  136. cin >> choice6;
  137. switch (choice6)
  138. {
  139. case 'Y': case 'y':
  140. {
  141. welcomeBanner();
  142. }
  143. case 'N': case 'n':
  144. {
  145. welcomeBanner();
  146. cout << "You have chosen not to progress." << endl;
  147. cout << "" << endl;
  148. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  149. choiceBanner();
  150. cin >> choice7;
  151. if ((choice7 == 'Y') || (choice7 == 'y'))
  152. help();
  153. else
  154. welcomeBanner();
  155. cout << "You have chosen not to go back." << endl;
  156. cout << "This program will now terminate." << endl;
  157. cout << "" << endl;
  158. exit(0);
  159. break;
  160. }
  161. default:
  162. {
  163. welcomeBanner();
  164. cout << "Program Error." << endl;
  165. cout << "" << endl;
  166. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  167. choiceBanner();
  168. cin >> choice7;
  169. if ((choice7 == 'Y') || (choice7 == 'y'))
  170. help();
  171. else
  172. welcomeBanner();
  173. cout << "You have chosen not to go back." << endl;
  174. cout << "This program will now terminate." << endl;
  175. cout << "" << endl;
  176. exit(0);
  177. break;
  178. }
  179. }
  180.  
  181. }
  182. }
  183. }
  184. case 'N': case 'n':
  185. {
  186. welcomeBanner();
  187. cout << "You have chosen not to progress." << endl;
  188. cout << "" << endl;
  189. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  190. choiceBanner();
  191. cin >> choice7;
  192. if ((choice7 == 'Y') || (choice7 == 'y'))
  193. help();
  194. else
  195. welcomeBanner();
  196. cout << "You have chosen not to go back." << endl;
  197. cout << "This program will now terminate." << endl;
  198. cout << "" << endl;
  199. exit(0);
  200. break;
  201. }
  202. default:
  203. {
  204. welcomeBanner();
  205. cout << "Program Error." << endl;
  206. cout << "" << endl;
  207. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  208. choiceBanner();
  209. cin >> choice7;
  210. if ((choice7 == 'Y') || (choice7 == 'y'))
  211. help();
  212. else
  213. welcomeBanner();
  214. cout << "You have chosen not to go back." << endl;
  215. cout << "This program will now terminate." << endl;
  216. cout << "" << endl;
  217. exit(0);
  218. break;
  219. }
  220. }
  221. }
  222. case 'N': case 'n':
  223. {
  224. welcomeBanner();
  225. cout << "You have chosen not to progress." << endl;
  226. cout << "" << endl;
  227. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  228. choiceBanner();
  229. cin >> choice7;
  230. if ((choice7 == 'Y') || (choice7 == 'y'))
  231. help();
  232. else
  233. welcomeBanner();
  234. cout << "You have chosen not to go back." << endl;
  235. cout << "This program will now terminate." << endl;
  236. cout << "" << endl;
  237. exit(0);
  238. break;
  239. }
  240. default:
  241. {
  242. welcomeBanner();
  243. cout << "Program Error." << endl;
  244. cout << "" << endl;
  245. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  246. choiceBanner();
  247. cin >> choice7;
  248. if ((choice7 == 'Y') || (choice7 == 'y'))
  249. help();
  250. else
  251. welcomeBanner();
  252. cout << "You have chosen not to go back." << endl;
  253. cout << "This program will now terminate." << endl;
  254. cout << "" << endl;
  255. exit(0);
  256. break;
  257. }
  258. }
  259. }
  260. case 'N': case 'n':
  261. {
  262. welcomeBanner();
  263. cout << "You have chosen not to progress." << endl;
  264. cout << "" << endl;
  265. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  266. choiceBanner();
  267. cin >> choice7;
  268. if ((choice7 == 'Y') || (choice7 == 'y'))
  269. help();
  270. else
  271. welcomeBanner();
  272. cout << "You have chosen not to go back." << endl;
  273. cout << "This program will now terminate." << endl;
  274. cout << "" << endl;
  275. exit(0);
  276. break;
  277. }
  278. default:
  279. {
  280. welcomeBanner();
  281. cout << "Program Error." << endl;
  282. cout << "" << endl;
  283. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  284. choiceBanner();
  285. cin >> choice7;
  286. if ((choice7 == 'Y') || (choice7 == 'y'))
  287. help();
  288. else
  289. welcomeBanner();
  290. cout << "You have chosen not to go back." << endl;
  291. cout << "This program will now terminate." << endl;
  292. cout << "" << endl;
  293. exit(0);
  294. break;
  295. }
  296. }
  297. }
  298. case 'N': case 'n':
  299. {
  300. welcomeBanner();
  301. cout << "You have chosen not to progress." << endl;
  302. cout << "" << endl;
  303. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  304. choiceBanner();
  305. cin >> choice7;
  306. if ((choice7 == 'Y') || (choice7 == 'y'))
  307. help();
  308. else
  309. welcomeBanner();
  310. cout << "You have chosen not to go back." << endl;
  311. cout << "This program will now terminate." << endl;
  312. cout << "" << endl;
  313. exit(0);
  314. break;
  315. }
  316. default:
  317. {
  318. welcomeBanner();
  319. cout << "Program Error." << endl;
  320. cout << "" << endl;
  321. cout << "Would you like to go back to the help function? (Y/N)" << endl;
  322. choiceBanner();
  323. cin >> choice7;
  324. if ((choice7 == 'Y') || (choice7 == 'y'))
  325. help();
  326. else
  327. welcomeBanner();
  328. cout << "You have chosen not to go back." << endl;
  329. cout << "This program will now terminate." << endl;
  330. cout << "" << endl;
  331. exit(0);
  332. break;
  333. }
  334. }
  335. break;
  336. }
  337. /*Second SWITCH Case, where users will get help on how to view the previous record.*/
  338. case 2:
  339. {
  340. helpBanner();
  341. cout << "You have chosen..." << endl;
  342. cout << "How TO: View Previous Records" << endl;
  343. cout << "" << endl;
  344. cout << "Would you like to go back (Y/N)? ";
  345. cin >> goback;
  346. /*Go back for when the user has finished*/
  347. if ((goback == 'Y') || (goback == 'y'))
  348. goto goback;
  349. else
  350. exit(0);
  351. break;
  352. }
  353. /*Third SWITCH Case, this is where the user will get help on how to clear the previous record*/
  354. case 3:
  355. {
  356. helpBanner();
  357. cout << "You have chosen..." << endl;
  358. cout << "How TO: Clear a record" << endl;
  359. cout << "" << endl;
  360. cout << "Would you like to go back (Y/N)? ";
  361. cin >> goback;
  362. /*Go back for when the user has finished*/
  363. if ((goback == 'Y') || (goback == 'y'))
  364. goto goback;
  365. else
  366. exit(0);
  367. break;
  368. }
  369. /*Fourth SWITCH Case, this is where the program will go back to int main. (Main Application)*/
  370. case 4:
  371. {
  372. main();
  373. break;
  374. }
  375. /*Default SWITCH Case, where when none of the cases are entered an error message will be displayed*/
  376. default:
  377. {
  378. helpBanner();
  379. cout << "Program Error." << endl;
  380. cout << "" << endl;
  381. cout << "Would you like to go back (Y/N)? ";
  382. cin >> goback;
  383. /*Go back for if the user would like to*/
  384. if ((goback == 'Y') || (goback == 'y'))
  385. goto goback;
  386. /*If the user chooses not to go back, the program will end.*/
  387. else
  388. cout << "" << endl;
  389. cout << "This program will now end." << endl;
  390. exit(0);
  391. break;
  392. }
  393.  
  394. }
  395. return 0;
  396. }
  397.  
  398. int newBooking() //Program newBooking Function
  399. {
  400. /*Variables decalred for the confirmation of personal details later on*/
  401. char termsConfirm, nameConfirm, issueConfirm, returnChoice, returnChoice2, returnChoice3;
  402. int choice;
  403.  
  404. startGoBack:
  405. bookingBanner();//Calls bookingBanner function
  406. /*Outputs to the CLI for the user to input their First & Last name*/
  407. cout << "" << endl;
  408. cout << "Welcome!" << endl;
  409. cout << "Please read the terms below, before continuing." << endl;
  410. cout << "" << endl;
  411. cout << "By agreeing to this contract, you agree to allow Tech-IT\nto diagnose and repair your device. Upon booking your\ndevice in, a 10 GBP booking fee applies, which is NOT\nrefundable. Futher fees will be discussed prior to any\nwork being carried out, which the customer has no obligation\nto continue using our service." << endl;
  412. cout << "" << endl;
  413. cout << "Would you like to continue? (Y/N)" << endl;
  414. cout << "Disclaimer: By continuing you agree to the terms above." << endl;
  415. choiceBanner();
  416. cin >> termsConfirm;
  417. switch (termsConfirm)
  418. {
  419. case 'Y': case 'y':
  420. {
  421. goto goback;
  422. break;
  423. }
  424. case 'N': case 'n':
  425. {
  426. welcomeBanner();
  427. cout << "You decided not to agree to the terms." << endl;
  428. cout << "This program will now end" << endl;
  429. exit(0);
  430. break;
  431. }
  432. }
  433.  
  434.  
  435. goback://Initializes a new goback for the specific function of newBooking
  436. bookingBanner();
  437. cout << "Please Fill In The Fields Below." << endl;
  438. cout << "-----------------------" << endl;
  439. cout << "" << endl;
  440. cout << "First Name: ";
  441. cin >> firstName; //User input (First Name)
  442. cout << "Last Name: ";
  443. cin >> lastName; //User input (Last Name)
  444.  
  445. fullName = firstName + lastName; //Variable concatenation adds the firstName & lastName together to then be stored as a new variable called fullName
  446.  
  447. cout << "-----------------------" << endl;
  448.  
  449. /*Confirmation stage to the first part. If the details inputted is incorrect then the program will loop back*/
  450. cout << "Please confirm that your name is: " << fullName << endl;
  451. cout << "Enter Answer Here (Y/N): ";
  452. cin >> nameConfirm;
  453. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  454. goto carryOn;
  455. else
  456. goto goback;
  457. /*Outputs to the CLI the contact information stage including phone number and email address.*/
  458. carryOn:
  459. system("cls");
  460. cout << "-----------------------" << endl;
  461. cout << "Contact Information" << endl;
  462. cout << "-----------------------" << endl;
  463. cout << "" << endl;
  464. cout << "Contact Telephone No: ";
  465. cin >> contactNumber; //User Input
  466. cout << "Email Address: ";
  467. cin >> emailAddress; //User Input
  468.  
  469. cout << "-----------------------" << endl;
  470.  
  471. /*Second confirmation stage. Confirm the contact information is correct.*/
  472. cout << "Is the information above correct?" << endl;
  473. cout << "Enter Answer Here (Y/N): ";
  474. cin >> nameConfirm;
  475. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  476. goto carryOn2;
  477. /*If the information is incorrect then the program will loop back and the user would have to start over*/
  478. else
  479. goto goback;
  480. /*Outputs to the CLI the item details which the user is submitting.*/
  481. carryOn2:
  482. system("cls");
  483. cout << "-----------------------" << endl;
  484. cout << "Item Details" << endl;
  485. cout << "-----------------------" << endl;
  486. cout << "Item Type: ";
  487. cin >> itemType; //User Input
  488. cout << "Item Make: ";
  489. cin >> itemMake; //User Input
  490. cout << "Item Model: ";
  491. cin >> itemModel; //User Input
  492.  
  493. cout << "-----------------------" << endl;
  494.  
  495. /*Third confirmation stage. Confirm the Item details is of what the user wants.*/
  496. cout << "Is the information above correct?" << endl;
  497. cout << "Enter Answer Here (Y/N): ";
  498. cin >> nameConfirm;
  499. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  500. goto carryOn3;
  501. else
  502. goto goback;
  503. /*Outputs to the CLI the problem stage of adding a new booking.*/
  504. carryOn3:
  505. system("cls");
  506. cout << "-----------------------" << endl;
  507. cout << "Select Your Problem" << endl;
  508. cout << "-----------------------" << endl;
  509. cout << "1. Power Issues" << endl;
  510. cout << "2. Screen Replacement" << endl;
  511. cout << "3. Peripheral Issues" << endl;
  512. cout << "4. Storage Issues" << endl;
  513. cout << "5. Cooling Issues" << endl;
  514. cout << "6. Other" << endl;
  515. choiceBanner();//Calls choiceBanner function
  516. cin >> choice; //User Input
  517. switch (choice) //Initializes a switch choice statment
  518. {
  519. /*Case 1: Power Issues.*/
  520. case 1:
  521. {
  522. deviceError = "Power Issues"; //Assigns a value to the global variable of deviceError
  523. system("cls"); //Clears the system screen
  524. /*New Banner for the Issue (Power)*/
  525. cout << "-----------------------" << endl;
  526. cout << "Your Issue: Power" << endl;
  527. cout << "-----------------------" << endl;
  528. cout << "Please elaborate on your specific issue below." << endl;
  529. cout << "Input Here: ";
  530. cin >> elaborate; //Allows user to expand on their issue. Can be left blank too.
  531.  
  532. cout << "-----------------------" << endl;
  533.  
  534. /*Confirmation of the information the user has inputted.*/
  535. cout << "Are you happy with the information you added?" << endl;
  536. cout << "Enter Answer Here (Y/N): ";
  537. cin >> nameConfirm;
  538. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  539. goto carryOn4;
  540. else
  541. goto carryOn3;
  542. }
  543. /*Case 2: Screen Replacement*/
  544. case 2:
  545. {
  546. deviceError = "Screen Replacement"; //Assigns a value to the global variable of deviceError
  547. system("cls");//Clears the system screen
  548. /*New Banner for the Issue (Screen Replacement)*/
  549. cout << "-----------------------" << endl;
  550. cout << "Your Issue: Screen" << endl;
  551. cout << "-----------------------" << endl;
  552. cout << "Please elaborate on your specific issue below." << endl;
  553. cout << "Input Here: ";
  554. cin >> elaborate;//Allows user to expand on their issue. Can be left blank too.
  555.  
  556. cout << "-----------------------" << endl;
  557.  
  558. /*Confirmation of the information the user has inputted.*/
  559. cout << "Are you happy with the information you added?" << endl;
  560. cout << "Enter Answer Here (Y/N): ";
  561. cin >> nameConfirm;
  562. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  563. goto carryOn4;
  564. else
  565. goto carryOn3;
  566. }
  567. /*Case 3: Peripheral Issues*/
  568. case 3:
  569. {
  570. deviceError = "Peripheral Issues"; //Assigns a value to the global variable of deviceError
  571. system("cls"); //Clears the system screen
  572. /*New Banner for the Issue (Peripheral Issue)*/
  573. cout << "-----------------------" << endl;
  574. cout << "Your Issue: Peripheral" << endl;
  575. cout << "-----------------------" << endl;
  576. cout << "Please elaborate on your specific issue below." << endl;
  577. cout << "Input Here: ";
  578. cin >> elaborate; //Allows user to expand on their issue. Can be left blank too.
  579.  
  580. cout << "-----------------------" << endl;
  581.  
  582. /*Confirmation of the information the user has inputted.*/
  583. cout << "Are you happy with the information you added?" << endl;
  584. cout << "Enter Answer Here (Y/N): ";
  585. cin >> nameConfirm;
  586. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  587. goto carryOn4;
  588. else
  589. goto carryOn3;
  590. }
  591. /*Case 4: Storage Issues*/
  592. case 4:
  593. {
  594. deviceError = "Storage Issues"; //Assigns a value to the global variable of deviceError
  595. system("cls"); //Clears the system screen
  596. /*New Banner for the Issue (Storage Issues)*/
  597. cout << "-----------------------" << endl;
  598. cout << "Your Issue: Storage" << endl;
  599. cout << "-----------------------" << endl;
  600. cout << "Please elaborate on your specific issue below." << endl;
  601. cout << "Input Here: ";
  602. cin >> elaborate; //Allows user to expand on their issue. Can be left blank too.
  603.  
  604. cout << "-----------------------" << endl;
  605.  
  606. /*Confirmation of the information the user has inputted.*/
  607. cout << "Are you happy with the information you added?" << endl;
  608. cout << "Enter Answer Here (Y/N): ";
  609. cin >> nameConfirm;
  610. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  611. goto carryOn4;
  612. else
  613. goto carryOn3;
  614. }
  615. /*Case 5: Cooling Issues*/
  616. case 5:
  617. {
  618. deviceError = "Cooling Issues"; //Assigns a value to the global variable of deviceError
  619. system("cls"); //Clears the system screen
  620. /*New Banner for the Issue (Cooling Issues)*/
  621. cout << "-----------------------" << endl;
  622. cout << "Your Issue: Cooling" << endl;
  623. cout << "-----------------------" << endl;
  624. cout << "Please elaborate on your specific issue below." << endl;
  625. cout << "Input Here: ";
  626. cin >> elaborate;
  627.  
  628. cout << "-----------------------" << endl;
  629.  
  630. /*Confirmation of the information the user has inputted.*/
  631. cout << "Are you happy with the information you added?" << endl;
  632. cout << "Enter Answer Here (Y/N): ";
  633. cin >> nameConfirm;
  634. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  635. goto carryOn4;
  636. else
  637. goto carryOn3;
  638. }
  639. /*Case 6: Other Issues*/
  640. case 6:
  641. {
  642. deviceError = "Other"; //Assigns a value to the global variable of deviceError
  643. system("cls"); //Clears the system screen
  644. /*New Banner for the Issue (Other Issues)*/
  645. cout << "-----------------------" << endl;
  646. cout << "Your Issue: Other" << endl;
  647. cout << "-----------------------" << endl;
  648. cout << "Please enter your specific issue below." << endl;
  649. cout << "Input Here: ";
  650. cin >> elaborate;
  651.  
  652. cout << "-----------------------" << endl;
  653.  
  654. /*Confirmation of the information the user has inputted.*/
  655. cout << "Are you happy with the information you added?" << endl;
  656. cout << "Enter Answer Here (Y/N): ";
  657. cin >> nameConfirm;
  658. if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
  659. goto carryOn4;
  660. else
  661. goto carryOn3;
  662. }
  663. }
  664. carryOn4:
  665. welcomeBanner(); //Calls welcomeBanner Function
  666. /*Outputs to the CLI that the user has successfully added a new booking*/
  667. cout << "Completed!" << endl;
  668. cout << "You have successfully added a new booking" << endl;
  669. cout << "" << endl;
  670. /*Asks the user whether they wish to return to the main page*/
  671. cout << "Do you wish to return Home [Y/N]: ";
  672. cin >> returnChoice; //User input assigned within variable returnChoice
  673. switch (returnChoice) //Calls Switch Statement returnChoice
  674. {
  675. case 'Y': case 'y': //Case is = Y/y then go back to intMain
  676. {
  677. break;
  678. }
  679. case 'N': case 'n': //Case = N/n then print text
  680. {
  681. welcomeBanner(); //Calls welcomeBanner function
  682. /*Output to the CLI the following text*/
  683. cout << "You have decided not to return home." << endl;
  684. cout << "" << endl;
  685. cout << "What would you like to do?" << endl;
  686. cout << "1. Add A New Booking" << endl;
  687. cout << "2. Terminate Program" << endl;
  688. choiceBanner(); //Calls choiceBanner function
  689. cin >> returnChoice2; //User Input
  690. switch (returnChoice2) //Call Switch Statement returnChoice2
  691. {
  692. case 1: //Allow the user to goback and add a new booking
  693. {
  694. goto goback;
  695. break;
  696. }
  697. case 2: //Program will terminate if chosen
  698. {
  699. cout << "Program Terminated" << endl;
  700. exit(0);
  701. break;
  702. }
  703. }
  704. default: //If the two cases are not inputted, then it'll fall back onto the default.
  705. {
  706. /*Outputs text to the CLI*/
  707. cout << "Error." << endl;
  708. cout << "-----------------------" << endl;
  709. cout << "Would you like to try again? [Y/N]" << endl;
  710. choiceBanner(); //Calls choiceBanner
  711. cin >> returnChoice3; //User Input
  712. switch (returnChoice3) //Call Switch Statement returnChoice3
  713. {
  714. case 1: //If case is equal to '1' then goto carryOn4
  715. {
  716. goto carryOn4;
  717. }
  718. case 2: //If case is equal to '2' then terminate program
  719. {
  720. cout << "Program Terminated" << endl;
  721. exit(0);
  722. break;
  723. }
  724. default: //If case is NOT equal to the above, then terminate program
  725. {
  726. cout << "Program Terminated" << endl;
  727. exit(0);
  728. break;
  729. }
  730. }
  731. }
  732.  
  733. }
  734. }
  735.  
  736. bookingNumber++; //Once a new booking has been created, it will then increase the bookingNumber variable by '1'
  737. return 0;
  738.  
  739. }
  740.  
  741. int previousRecords() //Calls previousRecords function
  742. {
  743. char gobackConfirm; //Declares variable
  744.  
  745. previousBanner(); //Calls previousBanner
  746. /*Outputs to the CLI the information from previous booking*/
  747. cout << "Total Number of Bookings : " << bookingNumber << endl; //Displays number of bookings
  748. cout << "-----------------------------" << endl;
  749. /*All the information which as been inputted within the "AddNewBooking" stage, will now all print out*/
  750. cout << "Last Booking" << endl;
  751. cout << "" << endl;
  752. cout << "-----------------------------" << endl;
  753. cout << "Contact Information" << endl;
  754. cout << "-----------------------------" << endl;
  755. cout << "First Name: " << firstName << endl;
  756. cout << "Last Name: " << lastName << endl;
  757. cout << "Phone: " << contactNumber << endl;
  758. cout << "Email: " << emailAddress << endl;
  759. cout << "-----------------------------" << endl;
  760. cout << "" << endl;
  761. cout << "-----------------------------" << endl;
  762. cout << "Item Details" << endl;
  763. cout << "-----------------------------" << endl;
  764. cout << "Item Type: " << itemType << endl;
  765. cout << "Item Make: " << itemMake << endl;
  766. cout << "Item Model: " << itemModel << endl;
  767. cout << "-----------------------------" << endl;
  768. cout << "" << endl;
  769. cout << "-----------------------------" << endl;
  770. cout << "Item Issue" << endl;
  771. cout << "-----------------------------" << endl;
  772. cout << "Issue: " << deviceError << endl;
  773. cout << "Issue Detail: " << elaborate << endl;
  774. cout << "-----------------------------" << endl;
  775.  
  776. cout << "" << endl;
  777.  
  778. /*Check whether the user wants to go back to the main application*/
  779. cout << "Do you wish to go back? Y/N" << endl;
  780. choiceBanner(); //Calls choiceBanner
  781. cin >> gobackConfirm; //User Input
  782. switch (gobackConfirm) //Calls Switch Statement gobackconfirm
  783. {
  784. case 'Y': case 'y': //If case is equal to Y/y then break application, and return to intMain
  785. {
  786. break;
  787. }
  788. case 'N': case 'n': //If case is equal to N/n then terminate program.
  789. {
  790. cout << "Program Terminated" << endl;
  791. exit(0);
  792. break;
  793. }
  794. default: //If input is not equal to any of the above then terminate program.
  795. {
  796. cout << "Program Terminated" << endl;
  797. exit(0);
  798. break;
  799. }
  800.  
  801. }
  802. return 0;
  803. }
  804.  
  805. int main() //Calls main function
  806. {
  807. int choice; //Declares variable "Choice" for a Switch
  808. char goback;
  809.  
  810. do{ //Initialize a do statement
  811. goback: //Declares a goback statement
  812. welcomeBanner(); //Calls welcomeBanner
  813. /*Outputs to the CLI the following text*/
  814. cout << "1. New Booking" << endl;
  815. cout << "2. Previous Records" << endl;
  816. cout << "3. Clear Previous Record" << endl;
  817. cout << "4. Tech-IT Help" << endl;
  818. cout << "5. Terminate Program" << endl;
  819.  
  820. choiceBanner(); //Calls choiceBanner
  821. cin >> choice; //User Input
  822. switch (choice) //Calls Switch Statement "Choice"
  823. {
  824. case 1: //If Case is equal to '1' then Switch to newBooking
  825. {
  826. newBooking();
  827. break;
  828. }
  829. case 2: //If Case is equal to '2' then Switch to previousRecords
  830. {
  831. previousRecords();
  832. break;
  833. }
  834. case 3:
  835. {
  836. welcomeBanner(); //Calls welcomeBanner
  837.  
  838. /*Assigns all global variables the value of none*/
  839. firstName = "None";
  840. lastName = "None";
  841. fullName = "None";
  842. emailAddress = "None";
  843. contactNumber = "None";
  844. itemType = "None";
  845. itemMake = "None";
  846. itemModel = "None";
  847. deviceError = "None";
  848. elaborate = "None";
  849.  
  850. cout << "The Previous Record Has Been Cleared!" << endl; //Outputs that all records have been cleared
  851. bookingNumber--; //Decreases the bookingNumber by 1
  852.  
  853. cout << "-----------------------" << endl; //Spacer
  854.  
  855. cout << "" << endl; //Line Break
  856. cout << "" << endl; // Line Break
  857. cout << "Would you like to go back? (Y/N)" << endl; //User Output
  858. choiceBanner(); //Calls choiceBanner
  859. cin >> goback; //User Input
  860. if ((goback == 'Y') || (goback == 'y')) //If Statement for going back. If it is equal to Y/y then goback
  861. goto goback;
  862. else //If it is not equal to Y/y, then program end.
  863. cout << "This program will now end" << endl;
  864. exit(0);
  865. break;
  866. }
  867. case 4: //If Case is equal to '3' then Switch to help
  868. {
  869. help();
  870. break;
  871. }
  872. case 5: //If Case is equal to '4' then output following
  873. {
  874. welcomeBanner(); //Calls welcomeBanner
  875. cout << "This program will now end." << endl; //Outputs "Program End"
  876. exit(0); //Terminate Program
  877. }
  878. }
  879. } while ((choice != 1) || (choice != 2) || (choice != 3) || (choice != 4)|| (choice != 5)); //End Do/While. If the choice is NOT equal to 1/2/3 then go back to where the "do" was declared.
  880.  
  881. goto goback; //Goback for when intMain is called from a function above.
  882. return 0; //End Program
  883. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement