using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using arun.CSharp.Namespaces;
public class Friend
{
public static void Main(string[] args)
//public static void Main()
{
Friend[] friend = new Friend[4];
int x;
string firstname;
string surname;
string phonenumber;
int month;
int day;
for (x = 0; x < friend.Length; ++x)
{
GetData(out firstname, out surname, out phonenumber, out month, out day);
friend[x] = new Friend(firstname, surname, phonenumber, month, day);
}
Array.Sort(friend);
Console.WriteLine("Sorted List:");
for (x = 0; x < friend.Length; ++x)
Display(friend[x]);
Console.ReadLine();
}
public static void GetData(out string firstname, out string surname, out string phonenumber, out int month, out int day)
{
string inString;
Console.Write("Please enter your friend's firstname: ");
inString = Console.ReadLine();
firstname = Convert.ToString(inString);
Console.Write("Please enter your friend's surname: ");
inString = Console.ReadLine();
surname = Convert.ToString(inString);
Console.Write("Please enter your friend's number: ");
inString = Console.ReadLine();
phone = Convert.ToString(inString);
Console.Write("Please enter your friend's birth MONTH: ");
inString = Console.ReadLine();
month = Convert.ToInt32(inString);
Console.Write("Please enter your friend's birth DAY: ");
inString = Console.ReadLine();
day = Convert.ToInt32(inString);
}
public static void Display(Friend fri)
{
Console.WriteLine("0,5}{1,-10}{2,6}{3,6}{4,6}",
fri.Name, fir.surname, fri.Phone, fri.Month, fri.Day);
}
}
public class Fri: IComparable
{
private string firstname;
private string surname;
private string phone;
private int month;
private int day;
public string Firstname { get; set; }
public string Surname { get; set; }
public string Phone { get; set; }
public int Month { get; set; }
public int Day { get; set; }
public Friend(string friendFirstName, string friendSurName, string friendNumber, int friendMonth, int friendDay)
{
firstName = friendFirstName;
surname = friendSurName;
Phone = friendNumber;
Month = friendMonth;
Day = friendDay;
}
int IComparable.CompareTo(object o)
{
int returnVal;
Friend temp = (Friend)o;
if (this.Name > temp.Name)
returnVal = 1;
else
if (this.Name < temp.Name)
returnVal = -1;
else
returnVal = 0;
return returnVal;
}
}
I am currently working on this code but i dont understand why it is asking me for a return type can anyone explain this to me I would be great thanks gemma