static void Main(string[] args) { var marbleBag = new MarbleBag(3, 1, 2); Console.WriteLine(marbleBag); marbleBag.BlueMarble = 5; Console.WriteLine(marbleBag); if (marbleBag.getTotalNumberOfMarbles() == 9) { Console.WriteLine("Total is 9, as expected"); } else { Console.WriteLine("PANIC!!!"); } marbleBag.removeAllGreenMarbles(); if (marbleBag.getTotalNumberOfMarbles() == 8) { Console.WriteLine("Total is 8, as expected"); } else { Console.WriteLine("Panic even more!!!"); } }
static void Main(string[] args) { var marbleBag = new MarbleBag(); marbleBag.Reds = 3; marbleBag.Greens = 1; marbleBag.Blues = 2; marbleBag.PrintInfo(); marbleBag.Blues = 5; if (marbleBag.GetTotalNumberOfMarbles() == 9) { Console.WriteLine("Total is 9, as expected."); } else { Console.WriteLine("PANIC!!!"); } marbleBag.RemoveAllGreenMarbles(); if (marbleBag.GetTotalNumberOfMarbles() == 8) { Console.WriteLine("Total is 8, as expected."); } else { Console.WriteLine("Panic even more!"); } }
static void Main(string[] args) { var marbles = new MarbleBag(5, 6, 7); Console.WriteLine(marbles); var total = marbles.TotalMarbles(); Console.WriteLine($"I have {total} marbles"); var removeGreen = marbles.RemoveGreenMarbles(); Console.WriteLine($"I now have {removeGreen} green marbles."); total = marbles.TotalMarbles(); Console.WriteLine($"I now have {total} marbles all together"); }
static void Main(string[] args) { var marbleBag = new MarbleBag(3, 1, 2); Console.WriteLine(marbleBag); marbleBag.BlueMarbles = 5; var total = marbleBag.getTotalNumberofMarbles(); Console.WriteLine($"The total number of marbles is: {total}."); marbleBag.removeAllGreenMarbles(); total = marbleBag.getTotalNumberofMarbles(); Console.WriteLine($"New Total Without Green Marbles: {total}."); }