public static int totalNumberOfPets;
public static int sumOflAllPetAges;
Console.WriteLine("How many pets do you own?");
int numberOfPets = int.Parse(Console.ReadLine());
Pet[] pets = new Pet[numberOfPets];
for (int i=0; i<numberOfPets; i++)
Console.WriteLine("What is your pet's name?");
pets[i].name = Console.ReadLine();
Console.WriteLine("What is this pet's age?");
pets[i].age = int.Parse(Console.ReadLine());
Console.WriteLine("What is this pet's breed?");
pets[i].breed = Console.ReadLine();
Pet.sumOflAllPetAges += pets[i].age;
Console.WriteLine("That makes the pet count: " + Pet.totalNumberOfPets);
for (int i=0; i<numberOfPets; i++)
Console.WriteLine("Your pet's details: ");
Console.WriteLine((i+1) + "-" + pets[i].name + ", who is " + pets[i].age + " years old, and is a " + pets[i].breed);
Pet youngestPet = pets[0];
for (int i=0; i<numberOfPets; i++)
if (pets[i].age >= oldestPet.age)
if (pets[i].age <= youngestPet.age)
double averageAge = (double) Pet.sumOflAllPetAges / (double) Pet.totalNumberOfPets;
Console.WriteLine("The youngest pet is: " + youngestPet.name);
Console.WriteLine("The oldest pet is: " + oldestPet.name);
Console.WriteLine("The average age is: " + averageAge);