Start New Discussion within our Software Development Community

I am fairly new to Visual C# .Net. Trying to learn:cry: When I try to complile the code below I get error that states the following;
"C:\C#\Chapter06\FriendList\Class1.cs(53): The class 'Friend' already contains a definition for 'Bday'" Where have I gone wrong? Can someone help me?

using System;
public class FriendList 
{
public static void Main()
{
Friend[] friend = new Friend[8];
int x;
string enteredData;
string enteredName;
int enteredphoneNumber;
double enteredBirthday;
for (x = 0; x < friend.Length; ++x)
friend[x] = new Friend();
for (x = 0; x < friend.Length; ++x)
{
Console.Write("Enter name for friend {0} ",x + 1);
enteredName = Console.ReadLine();
friend[x].SetName(enteredName);
Console.Write("Enter phonenumber for friend #{0} ",x + 1);
enteredData = Console.ReadLine();
enteredphonenumber = Convert.ToInt32(enteredData);
friend[x].SetPhonenumber(enteredphoneNumber);
Console.Write("Enter birthday for friend #{0} ",x + 1);
enteredData = Console.ReadLine();
enteredBirthday = ConvertToDouble(enteredData); 
friend[x].SetBirthday(enteredBirthday);
}
Console.WriteLine
("----------------------------------------------------");
for(x = 0; x < friend.Length; ++x)
Console.WriteLine
("Name is {0}, phone is {1}, and bday is {2}",
x +1, friend[x].GetName(), friend[x].GetPhone(),
friend[x].GetBday().ToString("F2"));
}
}
class Friend
{
private string Name;
private int phoneNumber;
private double Bday;

public string GetName()
{
return name;
} 
public int GetphoneNumber()
{
return phoneNumber;
}
public double Bday()
{
return Bday;
}
public void SetName(string friendName)
{
name = friendName;
}
public void SetphoneNumber(int phoneNumber)
{
phoneNumber = phone;
}
public void SetBday(double Bday)
{
Bday = birthday;
}
}
This article has been dead for over six months. Start a new discussion instead.