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); }
static void Main(string[] args) { Business business = new Business(); Salesman s1 = new Salesman(); s1.Name = "Julio"; s1.Age = 45; s1.Gender = 1; business.AddSalesman(s1); Salesman s2 = new Salesman(); s2.Name = "Maria"; s2.Age = 35; s2.Gender = 0; business.AddSalesman(s2); Salesman s3 = new Salesman(); s3.Name = "Natalia"; s3.Age = 22; s3.Gender = 0; business.AddSalesman(s3); Product p1 = new Product(); p1.Name = "shoes"; p1.Price = 70000; business.AddProduct(p1); Product p2 = new Product(); p2.Name = "shirts"; p2.Price = 40000; business.AddProduct(p2); Product p3 = new Product(); p3.Name = "lotions"; p3.Price = 50000; business.AddProduct(p3); Sale v1 = new Sale(); v1.Salesman = s1; v1.Product = p1; v1.Comments = "Sale #1"; business.AddSales(v1); Sale v2 = new Sale(); v2.Salesman = s2; v2.Product = p2; v2.Comments = "Sale #2"; business.AddSales(v2); Sale v3 = new Sale(); v3.Salesman = s3; v3.Product = p3; v3.Comments = "Sale #3"; business.AddSales(v3); Sale v4 = new Sale(); v4.Salesman = s3; v4.Product = p2; v4.Comments = "Sale #4"; business.AddSales(v4); // Sumar el total de las ventas int sum = (v1.Product.Price + v2.Product.Price + v3.Product.Price + v4.Product.Price); System.Console.WriteLine("Sales total amount: " + sum); // products price average int prom = (p1.Price + p2.Price + p3.Price) / 3; System.Console.WriteLine("average product price: " + prom); business.Biggestproduct(); business.Lessproduct(); business.Cheapseller(); business.Unitproduct(); }
static void Main(string[] args) { Seller s1 = new Seller(); s1.Name = "Jhan"; s1.Age = 21; Seller s2 = new Seller(); s1.Name = "Emma"; s1.Age = 10; Seller s3 = new Seller(); s1.Name = "Caro"; s1.Age = 22; Product pro1 = new Product(); pro1.Name = "TV"; pro1.Price = 200; Product pro2 = new Product(); pro2.Name = "Agua"; pro2.Price = 100; Product pro3 = new Product(); pro3.Name = "MP4"; pro3.Price = 200; Sale Sa1 = new Sale(); Sa1.Seller = s1; Sa1.Product = pro3; Sa1.Comments = "I like listening to music"; Sale Sa2 = new Sale(); Sa2.Seller = s2; Sa2.Product = pro1; Sa2.Comments = "I like watching movies"; Sale Sa3 = new Sale(); Sa3.Seller = s3; Sa3.Product = pro2; Sa3.Comments = "I was thirsty"; //Calculate the price of the total sale int value1 = Sa1.Product.Price; int value2 = Sa2.Product.Price; int value3 = Sa3.Product.Price; int valueT = 0; valueT = value2 + value1 + value3; System.Console.WriteLine("Total cost of all sales : " + valueT); }
public void Addsales(Sale newSale) { Sales[salesCount] = newSale; salesCount++; }