So the code is this but I can't figure out the problem. I included the error alongside with it.
using System;
public class SavingAccount
{
public static decimal interestRate = 0.02M;
public string Name { get; set; }
public decimal Balance { get; set; }
public SavingAccount(string n)
{
Name = n;
}
public SavingAccount(string n, decimal b)
{
Name = n;
Balance = b;
}
public void DisplayInfo()
{
Console.WriteLine("Account name: {0}\nAccount balance: {1}\nInterest Rate: {2}", Name, Balance, interestRate);
}
}
public class Testing
{
public static void Main(string[] args)
{
SavingAccount acct1 = new SavingAccount("Peter Chen");
SavingAccount acct2 = new SavingAccount("Al Molin", 5000m);
acct1.DisplayInfo();
Console.WriteLine();
acct2.DisplayInfo();
Console.WriteLine();
Console.WriteLine("Changing interest rate to 3%");
SavingAccount.interestRate = 0.03m;
acct1.DisplayInfo();
Console.WriteLine();
acct2.DisplayInfo();
Console.WriteLine();
}
}
Error 1 'Main': member names cannot be the same as their enclosing type
Any idea what the problem is. I looked through it a hundred times.