I am have trouble getting my program to print out an array of Employee class objects neat and orderly. I will proved my code, could someone please let me know how I would structure my write statement to make this happen.
What the output actually is:
Bruce Wayne, 123456, 25.88, 35.50
Clark Kent 232344 25.88 38.75
Diana Prince 657659 27.62 30.25
Hal Jordan 989431 23.14 44.25
Barry Allan 342562 25.12 25.50
Arthur Curry 565603 21.09 23.75
John Jones 812984 18.99 32.75
Dinah Lance 342988 18.99 34.50
Oliver Queen 340236 17.45 41.25
Ray Palmer 120985 24.75 40.00
Ronald Raymond 239824 16.43 35.00
Carter Hall 657123 19.34 42.75
Shayera Hol 761742 16.73 38.50
What the output should be:
Bruce Wayne 123456 25.88 35.50
Clark Kent 232344 25.88 38.75
Diana Prince 657659 27.62 30.25
Hal Jordan 989431 23.14 44.25
Barry Allan 342562 25.12 25.50
Arthur Curry 565603 21.09 23.75
John Jones 812984 18.99 32.75
Dinah Lance 342988 18.99 34.50
Oliver Queen 340236 17.45 41.25
Ray Palmer 120985 24.75 40.00
Ronald Raymond 239824 16.43 35.00
Carter Hall 657123 19.34 42.75
Shayera Hol 761742 16.73 38.50
// This is from the Employee class.
public void PrintEmployee()
{
Console.WriteLine(name + " " + number + " " + rate + " " + hours + "
" + gross);
}
// This is from main program.
for (int i = 0; i < Employees.Length; i++)
{
if (Employees[i] == null)
{
break;
}
Employees[i].PrintEmployee();
}
If you need more code please let me know. Also if anyone knows a nicer way of printing the table please let me know. All help is greatly appreciated.
