//Prints out the given Snack Object. private void DisplayMultiple(Snack snack) { //Console.WriteLine("Barcode: " + snack.ProductNumber); //Console.WriteLine("Snack Name: " + snack.Name); //Console.WriteLine("Weight: " + snack.Weight + " mg"); //Console.WriteLine("Price: " + snack.Price + " Dkk"); //Console.WriteLine(); string displaystring = string.Format("Barcode: {0,-5} Snack Name: {1,-20} Weight: {2,-10} Price: {3}", snack.ProductNumber, snack.Name, (snack.Weight + "mg"), (snack.Price + ".- Dkk")); Console.WriteLine(displaystring); }
//Constructor. Simply used to create admin users. public SnackDAL() { Snack bounty = new Snack(1, "Bounty Bar", 10, 20); this.snacks.Add(bounty); Snack twix = new Snack(2, "Twix", 15, 33); this.snacks.Add(twix); adminUsers.Add("admin", "1234"); }