static void Main(string[] args) { ns2.Person person2 = new ns2.Person(); ns3.Person person3 = new ns3.Person(); person2.Print(); person3.Print(); Console.ReadLine(); }
static void Main(string[] args) { Week1Problem1(); Week1Problem2(); Week1Problem3(); Week1Problem4(); Week1Problem5(); Week1Problem6(); Week1Problem7(); Week1Problem8(); Week1Problem9(); Week1Problem10(); Week1Problem11(); Week1Problem12(); Week1Problem13(); //Week1Problem14(numbers); int[] numbers2 = { 1, 4, 2, 6, 5, 8 }; //Week1Problem15(numbers2); int[] array = { 1, 2, 3, 2, 2, 2 }; //Week1Problem16(array); // Week 2 Problem 1 int number = Week2Problem1(2, 3); Console.WriteLine(number); // Week 2 Problem 2 string s1 = "hello"; string s2 = "hello"; Console.WriteLine(Week2Problem2(s1, s2)); string s3 = "world"; string s4 = "World"; Console.WriteLine(Week2Problem2(s3, s4)); // Week 2 Problem 3 string name = "Dave"; Week2Problem3(name); // Week 2 Problem 4 //Console.WriteLine(Week2Problem4(numbers)); // Week 2 Problem 5 Console.WriteLine(Week2Problem5("Hello", 1, 'a')); // Week 2 Problem 6 Console.WriteLine(Week2Problem6(2, 3)); // Week 2 Problem 7 int[] numbers3 = { 24, 13, 27, 8 }; Console.WriteLine(Week2Problem7(numbers3)); // Week 2 Problem 8 Person p1 = new Person(); p1.Name = "Frank"; p1.Age = 30; p1.Gender = "Male"; p1.Birthday(); Console.WriteLine(p1.Age); // Week 2 Problem 9 Vehicle v1 = new Vehicle(); //v1.Make = "Ford"; v1.Make = VehicleMake.Ford; v1.Model = "T"; v1.Color = "Brown"; v1.Miles = 1000m; v1.Year = 1925; Console.WriteLine(v1.IsNew()); //Should print out false; v1.Drive(100); Console.WriteLine(v1.Miles); //Should print out 1100; // Week 2 Problem 10 Point a = new Point(22.5m, -6.2m); Point b = new Point(0.0m, 10m); decimal calculatedDistance = a.Distance(b); Console.WriteLine(calculatedDistance); // Week 2 Problem 11 Employee a1 = new Employee("Sally", new DateTime(1972, 3, 15), "CEO", 120000m); Employee b1 = new Employee("Bill", new DateTime(1981, 1, 16)); Employee c1 = new Employee(); Console.WriteLine(Employee.Count); //Should print 3 // Week 2 Problem 11 Car c2 = new Car(); c2.Color = "Yellow"; Truck t = new Truck(); t.Miles = 100; // Week 2 Problem 11 Dog d = new Dog("Harry"); d.Dirty = true; Cat c3 = new Cat("Larry"); c3.Dirty = true; WashTheAnimal(d); WashTheAnimal(c3); // Week 2 Problem 11 CheckingAccount leesChecking = new CheckingAccount("12345", "Lee", 500m); SavingsAccount leesSavings = new SavingsAccount("54321", "Lee", 1000m); leesChecking.Withdraw(100m); Console.WriteLine(leesChecking.Balance); leesChecking.Withdraw(600m); Console.WriteLine(leesChecking.Balance); leesSavings.Deposit(100m); leesSavings.AddInterest(); leesSavings.Withdraw(200m); Console.WriteLine(leesSavings.Balance); // Week 3 Problem 1 ns1.Person person1 = new ns1.Person(); ns2.Person person2 = new ns2.Person(); person1.Print(); person2.Print(); // Week 3 Problem 2 List <Employee> employees = new List <Employee>(); employees.Add(new Employee("Rick", new DateTime(1981, 1, 16), "Software Engineer", 65000m)); employees.Add(new Employee("Tina", new DateTime(1978, 7, 4), "Senior Software Engineer", 85000m)); employees.Add(new Employee("Chris", new DateTime(1993, 2, 13), "Associate Software Engineer", 55000m)); employees.Add(new Employee("Mindy", new DateTime(1996, 8, 3), "Chief Technology Officer", 155000m)); foreach (Employee employee in employees) { Console.WriteLine(employee.Dispense()); } employees[2].Promote(10000m, "Software Engineer"); //But this does // Week 3 Problem 3 //Console.WriteLine("Enter your score"); //string input = Console.ReadLine(); //int grade = int.Parse(input); //int leadingDigit = grade / 10; //switch (leadingDigit) //{ // case 10: // Console.WriteLine("A"); // break; // case 9: // Console.WriteLine("A"); // break; // case 8: // Console.WriteLine("B"); // break; // case 7: // Console.WriteLine("C"); // break; // case 6: // Console.WriteLine("D"); // break; // default: // Console.WriteLine("F"); // break; //} // Week 3 Problem 4 Vehicle v2 = new Vehicle(); v2.Make = VehicleMake.Ford; v2.Model = "T"; v2.Color = "Brown"; v2.Miles = 1000m; v2.Year = 1925; // Week 3 Problem 5 try { Console.WriteLine("Enter a number"); int x = int.Parse(Console.ReadLine()); Console.WriteLine("Enter another number"); int y = int.Parse(Console.ReadLine()); Console.WriteLine("{0} + {1} = {2}", x, y, x + y); Console.WriteLine("{0} - {1} = {2}", x, y, x - y); Console.WriteLine("{0} * {1} = {2}", x, y, x * y); Console.WriteLine("{0} / {1} = {2}", x, y, x / y); Console.WriteLine("{0} mod {1} = {2}", x, y, x % y); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Press Enter to exit."); Console.ReadLine(); // Week 3 Problem 6 }