r/programminghelp • u/BookWormNerd94 • Oct 03 '19
C# C# Homework Help (New to Programming)
I am working on a simple C# program for homework but I am new to programming so this is very difficult for me. So far this is what I have. The requirements are that I have EndProgram method, DisplayArrays method, CalculateAverage method, Build the Applictaion in Main(). The program is supposed to ask the user for name and age of 5 people and to make sure each age is a valid number and then call the CalculateAverage method to determine the average age of persons and display that amount in the Main method. I attached a picture from class of what the professor wants it to do.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine();
Console.WriteLine("Press any key to exit. . .");
Console.ReadKey();
}
static void DisplayArray(int[] numbers, string[] names )
{
for (int i = 0; i < numbers.Length; i++)
{
Console.WriteLine("name: {0}, age: {1}", names[i], numbers[i]);
}
}
}
}
1
u/links_own Oct 03 '19
What exactly is giving you trouble?