tags:

views:

163

answers:

3
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void btnCalculate_Click(object sender, EventArgs e)
    {
        decimal decPossible;
        decimal finalPoints;

        decPossible = decimal.Parse(txtPossible.Text);
        //Get value from achieved textbox

        finalPoints = calculateGrade(decPossible, //achieved value);

WIGGLY LINE-> if (finalPoints >=90) //A percent max && finalPoints < 100)
        {
            lblGrade.Text = "A";
        }else if ( finalPoints > 79 && finalPoints <= 80 ) //B Range expression)
        {
            lblGrade.Text = "B";
        }else if ( finalPoints > 69 && finalPoints <= 70 ) //C Range expression)
        {
            lblGrade.Text = "C";
        }else if ( finalPoints > 59 && finalPoints <= 60 ) //D Range expression)
        {
            lblGrade.Text = "D"; //F Range expression)
        }
            else
        {
            lblGrade.Text = "F";
        }
}}
    System.out.println("Grade = " + lblGrade);
+6  A: 

Your "wiggly line" issue is caused by the line immediately above where you commented out part of the method call.

finalPoints = calculateGrade(decPossible, //achieved value); 

You failed to conclude that statement. If calculateGrade has an overload that only accepts the single parameter, you want to finish the statement as such.

finalPoints = calculateGrade(decPossible);

Also note that you've apparently got some Java in this code, as System.out.println is not a C# function. In C#, it would be Console.WriteLine.

Anthony Pegram
+2  A: 
finalPoints = calculateGrade(decPossible, //achieved value);

That is not a complete line. I'm guessing that's your problem.

Dan Tao
+3  A: 

This is because there is a compilation error and visual studio is highlighting the line that it thinks that is at fault.

As the others have pointed out the second parameter to the calculateGrade has been commented out. Because Visual Studio is expecting the next element to be a parameter it is complaining that the "if (finalPoints >=90)" syntax is incorrect.

Either remove the comment from the line above or put a null/default parameter in if there is a reason that you have commented the parameter out, for example:

finalPoints = calculateGrade(decPossible, null); //achieved value);
Bronumski
This is the CORRECT answer. Thank you and it's working now:)
Kombucha
GOOD JOB!!!!!!!!!!!!! - Why are some of the obvious things so hard to see? I think it's called tunnel vision.
Kombucha