コード例 #1
0
ファイル: Program.cs プロジェクト: bttalic/BitcampStudentTest
        static void Main(string[] args)
        {
            InventoryItem ii = new InventoryItem("name1", "some item", 33.1);
            Cars c1 = new Cars("car1", "some description", 345.2, "some type", 1999, "ford", "1");
            Watches w1 = new Watches("watch1", "some description", 500, "2", "some maker", 50);

            PawnShop ps = new PawnShop();
            ps.items.Add(ii);
            ps.items.Add(c1);
            ps.items.Add(w1);

            Staff s1 = new Staff("Name1","Surname1", 700);
            StaffExpert s2 = new StaffExpert("Name2", "Surname2", 700, "Watches");
            StaffExpert s3 = new StaffExpert("Name3", "Surname3", 700, "Cars");

            ps.employees.Add(s1);
            ps.employees.Add(s2);
            ps.employees.Add(s3);

            //AddCar(ps);
            //AddWatch(ps);

            //SearchByName(ps);
            //SearchByPrice(ps);

            PrintItems(ps);
            PrintStaff(ps);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: bttalic/BitcampStudentTest
        /// <summary>
        /// Adds new watch to item list
        /// </summary>
        /// <param name="ps">PawnShop ps</param>
        static void AddWatch(PawnShop ps)
        {
            string name = "-";
            Console.Write("Enter description: ");
            string description = Console.ReadLine();
            Console.Write("Enter price: ");
            double price = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter material - Gold = 1, Plastic = 2, Metal = 3: ");
            string material = Console.ReadLine();
            Console.Write("Enter how old: ");
            int year = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter maker: ");
            string maker = Console.ReadLine();

            Watches w = new Watches(name, description, price, material, maker, year);
            ps.items.Add(w);
        }