I'm trying to set up a property in a constructor that will store a minimum value of 7.50m when any value less than it is entered. The attributes have already been declared, I just need help with this if statement, everything compiles but when a value is entered < 7.5, it doesn't work...
public decimal PayRate
{
get
{
return payRate;
}
set
{
if (value <= 7.50m)
payRate = 7.50m;
else
payRate = value;
}
}
EDIT: Here's the code that enters the values... EDIT 2: The code following the namespace declaration, I can't change anything but add a property. It didn't get formatted.
static void Main(string[] args)
{
Employee e1 = new Employee("Chevy", "Jack", 'A', "987654321", 1.20m); }
And the namespace where everything is defined.
public Employee(string lName, string fName, char mi, string ss, decimal pay)
{
firstName = fName;
lastName = lName;
MiddleInitial = mi;
SSN = ss;
payRate = pay;
}