Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How would you improve this code
// *** NOTE ***
// ALL CHANGES MUST BE ACCOMPANIED BY COMMENTS
// PLEASE READ ALL COMMENTS / INSTRUCTIONS

C#
public static class Program
{
   static void Main(string[] args)
   {
      #region Assessment A
      // the below class declarations looks like a 1st year student developed it
      // IMPROVE THE ARCHITECTURE 
      Human human = new Human();
      human.Name = "John";
      human.Age = 35;
      human.Gender = "M";
      Console.WriteLine(human.GetDetails());

      Dog dog = new Dog();
      dog.Name = "Walter";
      dog.Age = 7;
      dog.Food = "Epol";
      Console.WriteLine(dog.GetDetails());

      Cat cat = new Cat();
      cat.Name = "Snowball";
      cat.Age = 35;
      cat.Food = "Whiskers";
      Console.WriteLine(cat.GetDetails());

      #endregion
   }
}
Posted
Updated 23-Nov-14 22:35pm
v2
Comments
Herman<T>.Instance 24-Nov-14 4:38am    
How come you cannot improve that?
Shweta N Mishra 24-Nov-14 4:39am    
What kind of improvement you need and what is your required result ?

1 solution

We can't improve that - that is your job.
It is, after all, your homework.
And we do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900