vendredi 29 janvier 2016

Can't get nested IF's to work properly in C#. What am I doing wrong?

What am I doing wrong exactly? I am not certain if the "&&" in the if conditions is what is causing the issue or if it is something else. I get a red mark underneath the ">=" part of the condition in every single "if". Can someone tell me how to remedy the issue?

  static void Main(string[] args)
    {
        Int32 pointsEarned;
        string firstName;
        string lastName;
        Int32 percentageGrade;
        Console.WriteLine("Enter the student's first name.");
        firstName = Console.ReadLine();
        Console.WriteLine("Enter the student's last name.");
        lastName = Console.ReadLine();
        Console.WriteLine("Enter the amount of points earned.");
        pointsEarned = int.Parse(Console.ReadLine());
        percentageGrade = pointsEarned / 1000;
        if (percentageGrade <=100 && >= 90);
        {
            string finalGrade = "A";
        }
        else if (percentageGrade <=89 && >= 80 );
        {
            string finalGrade = "B";
        }
        else if (percentageGrade <= 79 && >= 70);
        {
            string finalGrade = "C";
        }
        else if (percentageGrade <= 69 && >= 60);
        {
            string finalGrade = "D";
        }
        else if (percentageGrade <= 59 && >= 0);
        {
            string finalGrade = "F";
        }


    }
}

}

Aucun commentaire:

Enregistrer un commentaire