static void Main(string[] args) { string yesorno; do { Console.WriteLine("enter a toy"); string answer = Console.ReadLine(); List <string> ToyList = new List <string>(); var toys = new ToyBox(); ToyList.Add(answer); toys.Toys.Add(answer); Console.WriteLine("what is the manufacturer name"); string m = Console.ReadLine(); Toy mytoy = new Toy(m); string aisle = mytoy.GetAisle(); Console.WriteLine("do u want to add another toy?"); string response = Console.ReadLine(); yesorno = response.ToLower(); } while (yesorno == "yes"); Console.ReadKey(); }
static void Main(string[] args) { Toy Toy1 = new Toy(); ToyBox ToyBox1 = new ToyBox(); string ListTest = ""; string Answer = ""; do { Console.WriteLine("Please enter a toy"); Toy1.Name = Console.ReadLine(); Console.WriteLine($"Please enter the price of {Toy1.Name}"); Toy1.Price = Convert.ToDouble(Console.ReadLine()); Console.WriteLine($"Who is the manufacturer of {Toy1.Name}"); Toy1.Manufacturer = Console.ReadLine(); Console.WriteLine($"{Toy1.Name} (manufactured by {Toy1.Manufacturer} and costs {Toy1.Price.ToString("C2")}) is in aisle {Toy1.GetAisle()}"); ToyBox1.Toys.Add(Toy1); Console.WriteLine("Would you like to look up another toy? (y/n)"); Answer = Console.ReadLine(); } while (Answer == "y"); Console.WriteLine($"Here is what you have in your toy box {ToyBox1.Toys}"); }
static void Main(string[] args) { Toy Toy1 = new Toy(); Toy1.Manufacturer = "Target"; Toy1.Name = "Baby Doll"; Toy1.Price = 19.99; Toy Toy2 = new Toy(); Toy2.Manufacturer = "Amazon"; Toy2.Name = "Barbie Doll"; Toy2.Price = 24.99; ToyBox ToyBox1 = new ToyBox(); ToyBox1.Toys.Add(Toy1); ToyBox1.Toys.Add(Toy2); Toy Toy3 = new Toy(); Toy3.Manufacturer = "Toys R Us"; Toy3.Name = "Bouncy Ball"; Toy3.Price = 8.99; Toy Toy4 = new Toy(); Toy4.Manufacturer = "Walmart"; Toy4.Name = "Jump Rope"; Toy4.Price = 12.99; ToyBox ToyBox2 = new ToyBox(); ToyBox2.Toys.Add(Toy3); ToyBox2.Toys.Add(Toy4); Toy randomToy1 = ToyBox1.GetRandomToy(); Toy randomToy2 = ToyBox2.GetRandomToy(); Console.WriteLine($"{randomToy1} and is located on aisle {randomToy1.GetAisle()}."); Console.WriteLine($"{randomToy2} and is located on aisle {randomToy2.GetAisle()}."); Console.ReadKey(); }
static void Main(string[] args) { ToyBox ToyBox1 = new ToyBox(); Toy Toy1 = new Toy(); Toy1.Manufacturer = "Barbie"; Toy1.Name = "Doctor Barbie"; Toy1.Price = 14.99; Toy1.GetAisle(); Toy1.GetAisle2(); Console.WriteLine($"The manufacturer of Toy1 is {Toy1.Manufacturer}"); Console.WriteLine($"The name of Toy1 is {Toy1.Name}"); Console.WriteLine($"The price of Toy1 is {Toy1.Price}"); Console.WriteLine($"Toy1 is found on Aisle {Toy1.GetAisle()} {Toy1.GetAisle2()}"); Console.ReadKey(); }