Beispiel #1
0
        public void BuyIce()
        {
            Console.WriteLine("How many ice cubes are you buying?");
            amountOfIceCubes = int.Parse(Console.ReadLine());

            if (player.wallet.Money > 0.74)
            {
                if (amountOfIceCubes == 100)
                {
                    player.wallet.Money -= 0.74;
                }
                else if (amountOfIceCubes == 250)
                {
                    player.wallet.Money -= 2.16;
                }
                else
                {
                    player.wallet.Money -= 3.54;
                }



                for (int i = 0; i < amountOfIceCubes; i++)
                {
                    IceCube iceCube = new IceCube();
                    player.inventory.iceCubes.Add(iceCube);
                }
            }
            else
            {
                Console.WriteLine("You do not have enough money to buy ice cubes!");
            }
        }
Beispiel #2
0
        // Member methods

        // Method referenced from Store(); accepts type of item and quantity and adds quantity of item to the corresponding list
        public void AddToInventory(string item, int amount)
        {
            for (int i = 0; i < amount; i++)
            {
                switch (item)
                {
                case "lemons":
                    Lemon lemon = new Lemon();
                    lemons.Add(lemon);
                    break;

                case "sugar cubes":
                    SugarCube sugarCube = new SugarCube();
                    sugarCubes.Add(sugarCube);
                    break;

                case "ice cubes":
                    IceCube iceCube = new IceCube();
                    iceCubes.Add(iceCube);
                    break;

                case "cups":
                    Cup cup = new Cup();
                    cups.Add(cup);
                    break;
                }
            }
        }
Beispiel #3
0
 public Inventory()
 {
     cup      = new Cup();
     lemon    = new Lemon();
     sugar    = new Sugar();
     iceCubes = new IceCube();
 }
Beispiel #4
0
 public void AddIceCubesToInventory(int numberOfIceCubes)
 {
     for (int i = 0; i < numberOfIceCubes; i++)
     {
         IceCube iceCube = new IceCube();
         iceCubes.Add(iceCube);
     }
 }
Beispiel #5
0
 public void AddIce(int userInput)
 {
     for (int i = 0; i < userInput; i++)
     {
         IceCube ice = new IceCube();
         iceCubes.Add(ice);
     }
 }
Beispiel #6
0
 //constructor
 public Store()
 {
     multiplier = 0;
     storeInput = null;
     lemon      = new Lemon();
     sugar      = new Sugar();
     iceCube    = new IceCube();
     cup        = new Cup();
 }
 public void AddIceCubesToInventory(int numberOfIceCubes)
 {
     for (int i = 0; i < numberOfIceCubes; i++)
     {
         IceCube iceCube = new IceCube();
         iceCubes.Add(iceCube);
     }
     Console.WriteLine("You currently have {0} IceCube.\n\n", iceCubes.Count);
 }
 public Inventory()
 {
     cup        = new Cup();
     sugar      = new SugarCube();
     lemon      = new Lemon();
     ice        = new IceCube();
     cups       = new List <Cup>();
     lemons     = new List <Lemon>();
     sugarCubes = new List <SugarCube>();
     iceCubes   = new List <IceCube>();
 }
        public static Item PurchaseItems()
        {
            Item choosenitem = null;

            do
            {
                Console.WriteLine("Enter the item you like to purchase: Lemon, Sugar, Ice Cube, Cup....Enter Start to Skip");
                string itemInput = Console.ReadLine();


                switch (itemInput)
                {
                case "Lemon":
                    Console.WriteLine("How many? .20$ each");
                    choosenitem = new Lemon(0);
                    break;

                case "Sugar":
                    Console.WriteLine("How much? .12$ each");
                    choosenitem = new SugarCube(0);
                    break;

                case "Ice Cube":
                    Console.WriteLine("How many? 1.00$ for 10");
                    choosenitem = new IceCube(0);
                    break;

                case "Cup":
                    Console.WriteLine("How many? .10$");
                    choosenitem = new Cup(0);
                    break;

                case "Start":
                    choosenitem      = new Lemon(0);
                    choosenitem.name = "Start";
                    break;

                default:
                {
                    Console.WriteLine("Please Try again");
                    choosenitem = null;
                    break;
                }
                }
            } while (choosenitem == null);
            //if (choosenitem == null)//use function, will not return unless something is choosen
            //{
            //    PurchaseItems();
            //}

            //itemInput = null;
            return(choosenitem);
        }
Beispiel #10
0
        public List <Item> AddItem(int quantity, string type)
        {
            List <Item> list = new List <Item>();

            switch (type)
            {
            case "cups":
                for (int i = 0; i < quantity; i++)
                {
                    Cup cup = new Cup();
                    list.Add(cup);
                }
                return(list);

            case "ice cubes":
                for (int i = 0; i < quantity; i++)
                {
                    IceCube iceCube = new IceCube();
                    list.Add(iceCube);
                }
                return(list);

            case "sugar units":
                for (int i = 0; i < quantity; i++)
                {
                    SugarUnit sugarUnit = new SugarUnit();
                    list.Add(sugarUnit);
                }
                return(list);

            case "lemons":
                for (int i = 0; i < quantity; i++)
                {
                    Lemon lemon = new Lemon();
                    list.Add(lemon);
                }
                return(list);

            default:
                return(list);
            }
        }
Beispiel #11
0
        public void IncrementInventory(Item purchaseItem, int amountToIncrement)
        {
            string itemName = purchaseItem.name;

            switch (itemName)
            {
            case "lemon":
                for (int i = 0; i < amountToIncrement; i++)
                {
                    Lemon lemon = new Lemon();
                    lemons.Add(lemon);
                }
                break;

            case "cup of sugar":
                for (int i = 0; i < amountToIncrement; i++)
                {
                    CupOfSugar sugar = new CupOfSugar();
                    cupsOfSugar.Add(sugar);
                }
                break;

            case "pack of ice cubes":
                for (int i = 0; i < amountToIncrement; i++)
                {
                    IceCube ice = new IceCube();
                    iceCubes.Add(ice);
                }
                break;

            case "cup":
                for (int i = 0; i < amountToIncrement; i++)
                {
                    Cup cup = new Cup();
                    cups.Add(cup);
                }
                break;

            default:
                break;
            }
        }
Beispiel #12
0
        public void DecrementInventory(Item itemUsedInRecipe, int amountToDecrement)
        {
            string itemName = itemUsedInRecipe.name;

            switch (itemName)
            {
            case "lemon":
                for (int i = 0; i < amountToDecrement; i++)
                {
                    Lemon lemon = new Lemon();
                    lemons.Remove(lemon);
                }
                break;

            case "cup of sugar":
                for (int i = 0; i < amountToDecrement; i++)
                {
                    CupOfSugar sugar = new CupOfSugar();
                    cupsOfSugar.Remove(sugar);
                }
                break;

            case "pack of ice cubes":
                for (int i = 0; i < amountToDecrement; i++)
                {
                    IceCube ice = new IceCube();
                    iceCubes.Remove(ice);
                }
                break;

            case "cup":
                for (int i = 0; i < amountToDecrement; i++)
                {
                    Cup cup = new Cup();
                    cups.Remove(cup);
                }
                break;

            default:
                break;
            }
        }
Beispiel #13
0
        public void AddItemsToInventory(int quantity, string item)
        {
            switch (item)
            {
            case "cups":
                for (int i = 0; i < quantity; i++)
                {
                    Cup cup = new Cup();
                    cups.Add(cup);
                }
                break;

            case "lemons":
                for (int i = 0; i < quantity; i++)
                {
                    Lemon lemon = new Lemon();
                    lemons.Add(lemon);
                }
                break;

            case "sugar":
                for (int i = 0; i < quantity; i++)
                {
                    SugarCube sug = new SugarCube();
                    sugarCubes.Add(sug);
                }
                break;

            case "ice":
                for (int i = 0; i < quantity; i++)
                {
                    IceCube ice = new IceCube();
                    iceCubes.Add(ice);
                }
                break;
            }
        }
Beispiel #14
0
        public void AddIceCubes()
        {
            IceCube iceCube = new IceCube();

            iceCubesInInventory.Add(iceCube);
        }
Beispiel #15
0
 public static void DisplayIcePrice(IceCube iceCube)
 {
     Console.WriteLine("The price per ice cube is $ " + iceCube.price);
 }