Пример #1
0
 public static void Main(string[] args)
  {
      Person p1 = new Person(); //set the name
      p1.GetName(Console.ReadLine()); // set the age
      p1.SetAge(Convert.ToInt32(Console.ReadLine()); // write out the name and age
      Console.WriteLine(p1.GetName() + "is aged" + p1.GetAge());
  }
Пример #2
0
        static void Main(string[] args)
        {
            Person p1 = new Person("Jake Palmer", 16);

            Console.WriteLine("The name is " + p1.GetName());
            Console.WriteLine("The age is " + p1.GetAge());
            Console.WriteLine("What would you like the name to be set to?");
            p1.SetName(Console.ReadLine());
            Console.WriteLine("What would you like the age to be set to?");
            p1.SetAge(Convert.ToInt32(Console.ReadLine()));
            Console.WriteLine("What would you like the address to be set to?");
            Console.WriteLine("The address is " + p1.GetAddress());
            p1.SetAddress(Console.ReadLine());

            Console.WriteLine(p1);
            Console.ReadLine();
        }