I Have the first part of my code pretty complete and I got the gist of the rest, I'm just not sure how to put it all together. Here is the first part
using System;
namespace ConsoleApplication1
{
class Program
{
public class AccountInfo
{
public int Number { get; set; }
public double Balance { get; set; }
public string LastName { get; set; }
}
static void Main(string[] args)
{
List<AccountInfo> accounts = new List<AccountInfo>();
for (int index = 1; index < 6; index++)
{
AccountInfo acc = new AccountInfo();
Console.Write("Enter account number: " + index.ToString() + ": ");
acc.Number = int.Parse(Console.ReadLine());
Console.Write("Enter the account balance: ");
acc.Balance = double.Parse(Console.ReadLine());
Console.Write("Enter the account holder last name: ");
acc.LastName = Console.ReadLine();
accounts.Add(acc);
}
}
}
}
The second part is to ask the user what they want to do with the arrays
enter an a or A to search account numbers enter a b or B to average the accounts enter an x or X to exit program
the search part I can use something like this:
public void search Accounts()
{
for(int x = 0; x < validValues.Lenth; ++x)
{
if(acctsearched == validValues[x])
{
isValidItem = true;
acctNumber = Number[x];
}
}
And I can use a while loop with a bool true/false to close out.
I'm not sure how to get the average balance. I keep getting errors like "can't implicitly change int[] to int"
Any help with this would very much appreciated.