public static void PrintInventory(PawnShop i) { foreach (InventoryItem it in i.InventoryItem) { Console.WriteLine(it); } }
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); }
public static void PrintEmployees(PawnShop ps) { foreach (Employee e in ps.Employee) { Console.WriteLine(e); } }
/// <summary> /// Method performs search PawnShop /// </summary> /// <param name="ps"></param> /// <param name="s"></param> static void PrintSearch(PawnShop ps, string s) { List<ISearchable> res = ps.Find(s); foreach (ISearchable r in res) { Console.WriteLine(r); } }
/// <summary> /// Method prints inventory /// </summary> /// <param name="ps"></param> public static void PrintInventory(PawnShop ps) { foreach (Inventory i in ps.Inventories) { Console.WriteLine(i); } Console.WriteLine(); }
//public static void PrintInventory(PawnShop p) //{ // foreach (InventoryItem i in p.inventory) // { // Console.WriteLine(i); // } //} static void Main(string[] args) { PawnShop p = new PawnShop(); InventoryItem i = new InventoryItem("Auto","Some Descrition", 2000); Console.WriteLine(i); Cars c = new Cars("Car","Some Descrition ",2000,"Auto",1964,"Golf","Very Bad"); Console.WriteLine(c); }
/// <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); }
/// <summary> /// Adds new car to list /// </summary> /// <param name="ps">pawnShop ps</param> static void AddCar(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 type: "); string type = Console.ReadLine(); Console.Write("Enter year: "); int year = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter maker: "); string maker = Console.ReadLine(); Console.Write("Enter condition - Perfect = 1, Preserved = 2, Bad = 3 "); string condition = Console.ReadLine(); Cars c = new Cars(name, description,price,type,year,maker, condition); ps.items.Add(c); }
static void Main(string[] args) { PawnShop ps = new PawnShop(); Vehicle v = new Vehicle("Vehicle1", "Description1", 10000.5, "Type1", 2014, "Manufacturer1", Vehicle.Condition.Perfectly); Watch w = new Watch("Watch1", "Description2", 5000.4, Watch.Material.Silver, "Manufacturer2", 20); ps.AddInventory(v); ps.AddInventory(w); Employee e = new Employee("Edina", "Kudumovic", 200); Expert ex = new Expert("Rijad", "Memic", 200.5, "Expertise"); ps.AddEmployee(e); ps.AddEmployee(ex); PrintInventory(ps); PrintSearch(ps, "Vehicle1"); }
static void Main(string[] args) { PawnShop ps = new PawnShop(); Cars c = new Cars("BMW X5", "Fast and furious", 100000, "Jeep", 2014, "BMW", Cars.Condition.excellent); Clocks cl = new Clocks("Rolex","Old and good", 1400, "Sweden", Clocks.Period.Modern, Clocks.Material.gold); ps.AddInventory(c); ps.AddInventory(cl); PrintInventory(ps); Employee one = new Employee("Indiana", "Jones", 1000, Employee.Expert.Pawnbroker); Employee two = new Employee("Lara", "Croft", 20000, Employee.Expert.MilitaryAntiques); ps.AddEmployee(one); //ps.AddEmployee(two); PrintEmployees(ps); }
static void Main(string[] args) { PawnShop test = new PawnShop("Pawn"); test.AddTtem(new Cars("A8","somethig about car",20000,"SportCar",2015,"Audi",(car)1)); test.AddTtem(new Cars("X5","somethig about car",70000,"Car",2013,"BMW",(car)0)); test.AddTtem(new Cars("911", "somethig about car", 100000, "SportCar", 2015, "Porshe", (car)2)); while (true) { Console.WriteLine("1-Enter Item"); Console.WriteLine("2- Enter Employees"); Console.WriteLine("3- Sort Items"); Console.WriteLine("4 All Item"); int a; Int32.TryParse(Console.ReadLine(), out a); switch (a) { case 1: { Console.WriteLine("For enter item, press 1; For enter watches, press 2; For items press 3"); int c; Int32.TryParse(Console.ReadLine(), out c); if (c == 1) { Console.WriteLine("Enter type car"); string name = Console.ReadLine(); Console.WriteLine("Enter details"); string details = Console.ReadLine(); Console.WriteLine("year const. "); string autor = Console.ReadLine(); Console.WriteLine("Enter condition--- 0 perfectly, 1 preserved, 2 bad"); int choice; Int32.TryParse(Console.ReadLine(), out choice); test.AddTtem(new Cars(name, details, 1, "X6", 2015, "BMW", (car)1)); } if (c == 2) { Console.WriteLine("Enter watches "); string name = Console.ReadLine(); Console.WriteLine("Enter details "); string detalj = Console.ReadLine(); Console.WriteLine("Enter price "); string autor = Console.ReadLine(); Console.WriteLine("Enter condition--- 0 Perfectly, 1 Preserved, 2 Bad"); int choice; Int32.TryParse(Console.ReadLine(), out choice); //test.AddTtem(new Cars(name, details, 1, "Xty", 2015, "Rolex", (watches)1)); } if (c == 3) { Console.WriteLine("enter item"); string name = Console.ReadLine(); Console.WriteLine("enter details"); string details = Console.ReadLine(); Console.WriteLine("Enter price: "); //int price = Console.ReadLine(); test.AddTtem(new InventoryItem(name, details,200000)); } break; } case 2: { Console.WriteLine("Enter name employees: "); string name = Console.ReadLine(); Console.WriteLine("Enter Last name employees: "); string detalj = Console.ReadLine(); Console.WriteLine("plata: "); int choice; Int32.TryParse(Console.ReadLine(), out choice); test.AddEmployee(new Employees(name, detalj, choice)); break; } case 3: { //test.AddTtem(); break; } case 4: { foreach (Cars e in test.inventoryItems) { Console.WriteLine(e); } break; } default: { Console.WriteLine("invalid input"); break; } } } }
/// <summary> /// Prints all items /// </summary> /// <param name="ps">PawnShop ps</param> static void PrintItems(PawnShop ps) { foreach(var item in ps.items) { Console.WriteLine(item); } Console.WriteLine("----------------"); }
/// <summary> /// Searches items by price /// </summary> /// <param name="ps">PawnShop ps</param> static void SearchByPrice(PawnShop ps) { Console.Write("Enter your search: "); double price = Convert.ToDouble(Console.ReadLine()); foreach (var item in ps.items) { InventoryItem result = item.SearchByPrice(price); if (result != null) { Console.WriteLine("No item found!"); } else { Console.WriteLine(item.ToString()); } } }
/// <summary> /// Searches items by name /// </summary> /// <param name="ps">PawnShop ps</param> static void SearchByName(PawnShop ps) { Console.Write("Enter your search: "); string name = Console.ReadLine(); foreach (var item in ps.items) { InventoryItem result = item.SearchByName(name); if (result != null) { Console.WriteLine("No item found!"); } else { Console.WriteLine(item.ToString()); } } }
/// <summary> /// Print all employees /// </summary> /// <param name="ps">PawnShop ps</param> static void PrintStaff(PawnShop ps) { foreach (var member in ps.employees) { Console.WriteLine(member); } Console.WriteLine("----------------"); }