What I am trying to do is get the UserID to generate random values based on the type of class it is the userID should be generated from person.cs. For example the student class generates a student id and a random number the staff class is supposed to generate a staff id and a random number, the issue I am having is getting any userID sample data to show up at all in the console output, I don't get any data to show up for the userID can anyone help me.
Here's the links requested to view the code
Person.cs
public class Person
{
static string title;
protected string firstName;
protected string lastName;
protected string address;
protected string gender;
protected string dateOfBirth;
protected string userID;
protected Random rnd = new Random();
// constructors
public Person()
{
}//end default constructor
public Person(string aTitle, string aFirstName, string aLastName, string aAddress,
string aGender, string aDateOfBirth)
{
title = aTitle;
firstName = aFirstName;
lastName = aLastName;
address = aAddress;
gender = aGender;
dateOfBirth = aDateOfBirth;
Console.WriteLine( this.DisplayInfo() );
//create userID
Console.WriteLine(userID);
this.DisplayInfo();
}//end 6-parameter constructor
Just Added
public string DisplayInfo()
{
return " You have created the person " + firstName + lastName +"\n whose address is" + address + "\n" + " whos is a " + gender + " and was born on " + dateOfBirth;
}//end method DisplayInfo
Staff.cs student.cs has the same data for now
public class Staff : Person
{
public Staff(string aTitle, string aFirstName, string aLastName, string aAddress,
string aGender, string aDateOfBirth)
: base(aTitle, aFirstName, aLastName, aAddress,
aGender, aDateOfBirth)
{
this.userID = firstName.Substring(0, 1) + lastName.Substring(0, 5);
this.userID = this.userID + this.rnd.Next(1000, 9999);
}
PersonTest.cs
public class PersonTest
{
static void Main(string[] args)
{
Person testPerson = new Student("Mr.", "Merry ", "Lanes", " 493 Bluebane RD", "Male", " 8-06-1953 ");
Person studentPerson = new Person("Mr.", "Jerry ", "Panes", " 493 Bluebane RD", "Male", " 8-06-1953 ");
// THIS DATA SHOWS UP BUT NOT THE USERID
Console.ReadLine();
}//end main