I am trying to write this Program that gives the user the checkBox and then the user chooses One or Two and the Program will return the answer accordingly. but the program is not accepting the && Operator. if the user checks two boxes the program is only returning the result of the first checkBox not the second. it is not even adding.
This is the Code:
private double Oillube()
{
//checking if the Oil is checked
if (oilChbox.Checked)
{
return OIL_CHANGE;
}
//checking if the lube is checked
if (lubeChbox.Checked)
{
return LUBE_JOB;
}
//if they are both checked
if(lubeChbox.Checked && oilChbox.Checked)
{
//Creating Variables sum to hold the value of the two
double sum;
sum = OIL_CHANGE + LUBE_JOB;
//returning sum
return sum;
}
else
{
//just returning to get ride off the red line under the Method
return 0;
}
}