static void Main(string[] args) { Customer dustin = new Customer() { FirstName = "Dustin", LastName = "Hitzing", Age = 27, SingingVoice = "TRBL", BillingAddress = new Address() { Street = "Rice Gate Dr.", City = "Savannah", State = "Georgia", ZipCode = "33908" } }; Customer jim = new Customer() { FirstName = "Jimmothy", LastName = "Boy", Age = 23567, SingingVoice = "The most wonderful thinge ever", BillingAddress = new Address() { Street = "Pine Grove Blvd", City = "Walla Walla", State = "Washington", ZipCode = "45893" }, Savings = new BankAccount() { Id = 1, Type = "Savings", Ammount = 0.00m, IsOpen = true }, Checking = new BankAccount() { Id = 2, Type = "Checking", Ammount = 100.00m, IsOpen = true } }; int oldDustin = dustin.MakeOlder(45); Console.WriteLine(oldDustin); Console.ReadLine(); jim.Transfer(50.00m, jim.Checking, jim.Savings); Console.WriteLine(jim.Checking.Ammount); Console.WriteLine(jim.Savings.Ammount); Console.ReadLine(); }
static void Main(string[] args) { //Product with constructor var snack = new Product("Goldfish Snack", 3.45m, 5, "Xplosive pizza flavored"); Console.WriteLine("{0} Price: {1:c} Units In Stock: {2} Description: {3} ", snack.Name, snack.Price, snack.UnitsInStock, snack.Description); Debug.Assert(snack.Name == "Goldfish Snack", "Product: Goldfish Snack"); var drink = new Product("Sprite", 1.05m, 10); Console.WriteLine("{0} Price: {1:c} Units In Stock: {2}", drink.Name, drink.Price, drink.UnitsInStock); //Customer with constuctor var sarah = new Customer("Sarah", "Kim", 24, "*****@*****.**"); Console.WriteLine("Name: {0} {1} Age: {2} Email Address: {3}", sarah.FirstName, sarah.LastName, sarah.Age, sarah.Email); Customer sally = new Customer() { FirstName = "Sally", LastName = "Williams", Age = 23, Email = "*****@*****.**", BillingAddress = new Address() { Street = "12345 Somewhere", City = "Pearland", State = "Texas", Zipcode = "77123" }, ShippingAddress = new Address() { Street = "12345 Somewhere Else", City = "Houston", State = "Texas", Zipcode = "77000" } }; Address mikeAddress = new Address() { Street = "55555 This Place", City = "Houston", State = "Texas", Zipcode = "70707" }; Customer mike = new Customer() { FirstName = "Mike", LastName = "Harrison", Age = 45, Email = "*****@*****.**", BillingAddress = mikeAddress, ShippingAddress = mikeAddress }; //Bank Account Complex Classes Customer alice = new Customer() { Check = new BankAccount() { ID = "Alice1", Type = "Checking Account", Amount = 100m, IsOpen = true }, Save = new BankAccount() { ID = "Alice2", Type = "Savings Account", Amount = 0m, IsOpen = false } }; Customer sarahKim = new Customer() { Save = new BankAccount() { ID = "Sarah1", Type = "Savings Account", Amount = 4539.88m, IsOpen = true } }; alice.Transfer(sarahKim.Save, alice.Check, 100m); Console.WriteLine("Alice's Current Balance: {0:c}", alice.Check.Amount); Console.WriteLine("Sarah's Current Balance: {0:c}", sarahKim.Save.Amount); Console.ReadLine(); }