Пример #1
0
        static void Main(string[] args)
        {
            Company company = new Company();

            SalesMan seller1 = new SalesMan();

            seller1.Name = "Arturo Rojas";
            seller1.Age  = 45;
            company.AddSalesMan(seller1);

            SalesMan seller2 = new SalesMan();

            seller2.Name = "Adriana Zuluaga";
            seller2.Age  = 38;
            company.AddSalesMan(seller2);

            SalesMan seller3 = new SalesMan();

            seller3.Name = "Carlos Vallejo";
            seller3.Age  = 41;
            company.AddSalesMan(seller3);

            Product p1 = new Product();

            p1.Name = "computer";
            p1.SetPrice(1000);
            company.AddProduct(p1);

            Product p2 = new Product();

            p2.Name = "smartphone";
            p2.SetPrice(600);
            company.AddProduct(p2);

            Product p3 = new Product();

            p3.Name = "smart tv";
            p3.SetPrice(900);
            company.AddProduct(p3);

            Sale s1 = new Sale();

            s1.Product  = p2;
            s1.SalesMan = seller1;
            s1.Comments = "Arturo sold a smartphone";
            company.AddSale(s1);

            Sale s2 = new Sale();

            s2.Product  = p3;
            s2.SalesMan = seller2;
            s2.Comments = "Adriana sold a smart tv";
            company.AddSale(s2);

            Sale s3 = new Sale();

            s3.Product  = p1;
            s3.SalesMan = seller3;
            s3.Comments = "Carlos sold a computer";
            company.AddSale(s3);

            string CheapestSale     = company.CheapestSale().Name;
            string ExpensiveProduct = company.ExpensiveProduct().Name;
            double ProductsAverage  = company.ProductsAverage();
            int    SalesUnits       = company.SalesUnits();
            double salesTotal       = s1.Product.GetPrice() + s2.Product.GetPrice() + s3.Product.GetPrice();

            System.Console.WriteLine("Sales total acound US$ " + salesTotal);
            System.Console.WriteLine("the seller who made the cheapest sale is " + CheapestSale);
            System.Console.WriteLine("the most expensive product " + ExpensiveProduct);
            System.Console.WriteLine("Products price average US$ " + ProductsAverage);
            System.Console.WriteLine("the units that have been sold are " + SalesUnits);
        }
Пример #2
0
        static void Main(string[] args)
        {
            SalesMan sm = new SalesMan();

            sm.SetAgeN(20);
            sm.Name = "Luis";

            SalesMan sm1 = new SalesMan();

            sm1.SetAgeN(20);
            sm1.Name = "Manuela";

            SalesMan sm2 = new SalesMan();

            sm2.SetAgeN(18);
            sm2.Name = "Edwar";

            SalesMan sm3 = new SalesMan();

            sm3.SetAgeN(56);
            sm3.Name = "Maximo";

            Product pd = new Product();

            pd.Name = "Headphones";
            pd.SetPrice(40000);

            Product pd1 = new Product();

            pd1.Name = "Monitor Samsung";
            pd1.SetPrice(652000);

            Product pd2 = new Product();

            pd2.Name = "Mouse";
            pd2.SetPrice(20000);

            Product pd3 = new Product();

            pd3.Name = "Keyboard";
            pd3.SetPrice(150000);

            Sale sl = new Sale();

            sl.Product = pd;
            sl.Seller  = sm;
            sl.Comment = "Kotion Each G2000 Usb Microfono Ledl";

            Sale sl1 = new Sale();

            sl1.Product = pd1;
            sl1.Seller  = sm1;
            sl.Comment  = "Led Ref: Ls24f350fh ";


            Sale sl2 = new Sale();

            sl2.Product = pd2;
            sl2.Seller  = sm2;
            sl.Comment  = "Mouse Ergonómico Microsoft Negro";

            Sale sl3 = new Sale();

            sl3.Product = pd3;
            sl3.Seller  = sm3;
            sl.Comment  = "Metallic Gamer Keyboard Wb-539 Backlit Mechanical";

            float SaleTotal;

            SaleTotal = sl.Product.Price + sl1.Product.Price + sl2.Product.Price + sl3.Product.Price;



            System.Console.WriteLine("The total sales value is generated was by  " + SaleTotal);
        }
Пример #3
0
 public void AddSalesMan(SalesMan newSalesMan)
 {
     Sellers[sellersCount] = newSalesMan;
     sellersCount++;
 }