aboutsummaryrefslogtreecommitdiff
blob: 6cc053c56238ba5e654b53ddf7c184897e1c8600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;

namespace KukaPizza.Models
{
    public class Pizza
    {
        private string _name;
        private List<Topping> _toppings;
        private double _price;

        public Pizza(string name, List<Topping> toppings, double price)
        {
            _name = name;
            _toppings = toppings;
            _price = price;
        }

        public string Name { get { return _name; } }
        public List<Topping> Toppings { get { return _toppings; } }
        public double Price { get { return _price; } }

        public string ToppingsToString()
        {
            string toppings = "";

            for (int i = 0; i < _toppings.Count - 1; i++)
            {
                toppings += _toppings[i].Name + ", ";
            }

            toppings += _toppings[_toppings.Count - 1].Name;

            return toppings;
        }
    }
}