Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.82 KB | None | 0 0
  1. #include "Menue.h"
  2.  
  3.  
  4.  
  5. Menue::Menue()
  6. {
  7.     menue_cocktail_machine_ = new CocktailMachine;
  8. }
  9.  
  10.  
  11. Menue::~Menue()
  12. {
  13. }
  14.  
  15. void Menue::menue_Menue()                                  
  16. {
  17.     do
  18.     {
  19.         cout << "== CocktailMix | V0.1 ==" << endl;
  20.         cout << "1 - Make Cocktails" << endl;
  21.         cout << "2 - Configure CocktailMix" << endl;
  22.         cout << "0 - Exit" << endl;
  23.         cout << "Selection: ";
  24.         std::cin >> selection;
  25.         switch (selection)
  26.         {
  27.         case 1: std::system("cls");
  28.             submenue_makecocktails();
  29.             break;
  30.         case 2: std::system("cls");
  31.             submenue_configure_cocktail();
  32.             break;
  33.         case 0: std::system("cls");
  34.             cout << "Program is closing.." << endl;
  35.             exit(EXIT_SUCCESS);
  36.         default: std::system("cls");
  37.             cout << "wrong input" << endl;
  38.             break;
  39.         }
  40.     } while (selection != 0);
  41. }
  42.  
  43. void Menue::submenue_makecocktails()
  44. {
  45.     system("cls");
  46.     cout << "== CocktailMix | Mix it ==" << endl;
  47.     for (int i = 0; i < menue_cocktail_machine_->getCocktails().size(); ++i)
  48.     {
  49.         cout << i+1 << " - " << menue_cocktail_machine_->getCocktails().at(i)->getCocktailName() << endl;
  50.     }
  51.     cout << "Selection: ";
  52.     std::cin >> selection;
  53.     if (selection > 0 && selection <= menue_cocktail_machine_->getCocktails().size())
  54.     {
  55.         menue_cocktail_machine_->getCocktails().at(selection - 1)->printCocktail();
  56.         std::cin.ignore();
  57.         getchar();
  58.     }
  59. }
  60.  
  61. void Menue::submenue_configure_cocktail()
  62. {
  63.     cout << "== CocktailMix | Configure ==" << endl;
  64.     cout << "1 - Configure Dispensers" << endl;
  65.     cout << "2 - List Cocktail" << endl;
  66.     cout << "3 - Add Cocktail" << endl;
  67.     cout << "4 - Edit Cocktail" << endl;
  68.     cout << "5 - Delete Cocktail" << endl;
  69.     cout << "0 - Exit" << endl;
  70.     cout << "Selection: ";
  71.     std::cin >> selection;
  72.     switch(selection)
  73.     {
  74.     case 1: submenue_configure_dispensers();
  75.         break;
  76.     case 2:
  77.         break;
  78.     case 3:
  79.         break;
  80.     case 4:
  81.         break;
  82.     case 5:
  83.         break;
  84.     case 0: std::system("cls");
  85.         menue_Menue();
  86.         break;
  87.     default: std::system("cls");
  88.         cout << "wrong input" << endl;
  89.         break;
  90.     }
  91. }
  92.  
  93. void Menue::submenue_configure_dispensers()
  94. {
  95.     std::system("cls");
  96.     cout << "== CocktailMix | Configure Dispenser ==" << endl;
  97.     for (int i = 0; i < 6; ++i)
  98.     {
  99.         cout << i + 1 << " - " << menue_cocktail_machine_->getDispenser()[i]->getDispenserIngredient()->getIngredientName() << endl;
  100.     }
  101.     cout << "0 - Exit" << endl;
  102.     cout << "Selection: ";
  103.     std::cin >> selection;
  104.     submenue_configure_ingredient(selection - 1);
  105. }
  106.  
  107. void Menue::submenue_configure_ingredient(const int dispenserPos)
  108. {
  109.     Ingredient* tmp_ingredient = new Ingredient;
  110.     cout << "== CocktailMix | Select Ingredient ==" << endl;
  111.     for (int i = 0; i < menue_cocktail_machine_->getIngredients().size(); ++i)
  112.     {
  113.         cout << i + 1 << " - " << menue_cocktail_machine_->getIngredients()[i]->getIngredientName() << endl;
  114.     }
  115.     cout << "0 - Free / Exit" << endl;
  116.     cout << "Selection: ";
  117.     std::cin >> selection;
  118.    
  119.     if(selection == 0)
  120.     {
  121.         string free = "FREE";
  122.         tmp_ingredient = new Ingredient;
  123.         tmp_ingredient->setIngredientName(free);
  124.         menue_cocktail_machine_->getDispenser().at(dispenserPos)->setDispenserIngredient(tmp_ingredient);
  125.         /*
  126.          *
  127.          *ingredientName = "FREE";
  128.          *tmp_ingredient->setIngredientName(ingredientName);
  129.          *menue_cocktail_machine_->getDispenser().at(dispenserPos)->setDispenserIngredient(tmp_ingredient);
  130.          *tmp_ingredient = new Ingredient;
  131.          *
  132.          */
  133.     }
  134.     else
  135.     {
  136.         tmp_ingredient = menue_cocktail_machine_->getIngredients().at(selection - 1);
  137.         menue_cocktail_machine_->getDispenser().at(dispenserPos)->setDispenserIngredient(tmp_ingredient);
  138.         /*
  139.          *
  140.          *ingredientName = menue_cocktail_machine_->getIngredients().at(selection - 1)->getIngredientName();
  141.          *tmp_ingredient->setIngredientName(ingredientName);
  142.          *menue_cocktail_machine_->getDispenser().at(dispenserPos)->setDispenserIngredient(tmp_ingredient);
  143.          *tmp_ingredient = new Ingredient;
  144.          *
  145.          */
  146.     }
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement