Advertisement
Guest User

OOP Project December

a guest
Nov 20th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.16 KB | None | 0 0
  1. // Project.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include <iostream>
  5. #include <string>
  6. #include "Item.h"
  7.  
  8. CItem itemList[25];
  9.  
  10. void showmenu(void);
  11. void passwordprotection(void);
  12. void selection(void);
  13.  
  14. void DoInitializePriceList(void);
  15. void DoDisplayFullPriceList(void);
  16. void DoAddItemToList(void);
  17. void DoSetItemPrice(void);
  18. void DoSetItemDiscountRate(void);
  19. void DoDisplayItem(void);
  20. void DoOrderCost(void);
  21. void DoRemoveItemFromList(void);
  22. void DoQuit(void);
  23.  
  24. using namespace std;
  25.  
  26. int main()
  27. {
  28.     int exit = 0;
  29.  
  30.     passwordprotection();
  31.  
  32.     while (exit == 0)
  33.     {
  34.         selection();
  35.     }
  36. }
  37.  
  38. void selection(void)
  39. {
  40.     char selection = 0;
  41.  
  42.     cout << "\n\nPlease enter option number: ";
  43.     cin >> selection;
  44.  
  45.     switch (selection)
  46.     {
  47.     default:
  48.     {
  49.  
  50.         if (isdigit(selection))
  51.         {
  52.             cout << "\nThat is not a valid menu option" << endl;
  53.         }
  54.         else {
  55.             cout << "\nThat is not a number" << endl;
  56.         }
  57.             break;
  58.     }
  59.     case 0: {
  60.         showmenu(); break;
  61.     }
  62.     }
  63.  
  64.  
  65.  
  66.  
  67.     return;
  68. }
  69.  
  70. void showmenu(void)
  71. {
  72.     cout << "\n\n1. Initialize Price List" << endl;
  73.     cout << "2. Display Full Price List" << endl;
  74.     cout << "3. Add Item to List" << endl;
  75.     cout << "4. Set Item Price" << endl;
  76.     cout << "5. Set Item Discount Rate" << endl;
  77.     cout << "6. Display Item" << endl;
  78.     cout << "7. Order Cost" << endl;
  79.     cout << "8. Remove Item from List" << endl;
  80.     cout << "0. Quit" << endl;
  81.  
  82.  
  83. }
  84.  
  85. void passwordprotection(void)
  86. {
  87.     string attempt;
  88.     const string password = "password";
  89.  
  90.     cout << "\n\nPlease enter password: ";
  91.     cin >> attempt;
  92.  
  93.     if (attempt == password)
  94.     {
  95.         return;
  96.     }
  97.  
  98.     for (int i = 1; i < 3; i++)
  99.     {
  100.         cout << "\nPassword incorrect, please try again: ";
  101.         cin >> attempt;
  102.  
  103.         if (attempt == password)
  104.         {
  105.             return;
  106.         }
  107.     }
  108.  
  109.     exit(0);
  110.  
  111. }
  112.  
  113. void DoInitializePriceList(void)
  114. {
  115.  
  116. }
  117.  
  118. void DoDisplayFullPriceList(void)
  119. {
  120.  
  121. }
  122.  
  123. void DoAddItemToList(void)
  124. {
  125.  
  126. }
  127.  
  128. void DoSetItemPrice(void)
  129. {
  130.  
  131. }
  132.  
  133. void DoSetItemDiscountRate(void)
  134. {
  135.  
  136. }
  137.  
  138. void DoDisplayItem(void)
  139. {
  140.  
  141. }
  142.  
  143. void DoOrderCost(void)
  144. {
  145.  
  146. }
  147.  
  148. void DoRemoveItemFromList(void)
  149. {
  150.  
  151. }
  152.  
  153. void DoQuit(void)
  154. {
  155.     exit(0);
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement