This is my code so far in visual studio.
This is my code so far in visual studio. I want the code to restart with enter student name instead of
terminating when the values entered produce an error. I think I need a while statement. If you could show me where it needs to be placed to start the while loop that would be helpful.
static void Main(string[] args)
{
double points = 0;
string lastName;
string firstName;
Console.WriteLine(“Welcome to the Student Grade Calculator”);
Console.WriteLine(“Please Enter Students first name “);
firstName = Convert.ToString(Console.ReadLine());
Console.WriteLine(“Enter ” + firstName + “‘s Last Name “);
lastName = Convert.ToString(Console.ReadLine());
Console.WriteLine(“Enter ” + firstName + ” ” + lastName + “‘s” + ” Total Points Earned”);
points = Convert.ToDouble(Console.ReadLine());
if (points >= 900 && points <= 1000)
{
points = points / 10;
Console.WriteLine(“________________________________________________________________________________________________________________________”);
Console.WriteLine(“Student Grade Is ” + points + ” Great Job”);
Console.WriteLine(“student Grade is in 90 – 100 percentile Student Letter Grade ‘A'”);
Console.WriteLine(“”);
Console.WriteLine(“********************Terminating program*********************************************************************************”);
Console.WriteLine(“Thank you for using the Student Grading Calculator”);
Console.ReadLine();
}
else if (points >= 800 && points <= 900)
{
points = points / 10;
Console.WriteLine(“________________________________________________________________________________________________________________________”);
Console.WriteLine(“Student Grade Is ” + points + ” Good Work”);
Console.WriteLine(“Student Grade Is In 80 – 90 Percentile Student Letter Grade ‘B'”);
Console.WriteLine(“”);
Console.WriteLine(“*****************************Terminating Program************************************************************************”);
Console.WriteLine(“Thank You for Using the Student Grade Calculator”);
Console.ReadLine();
}
else if (points >= 700 && points <= 800)
{
points = points / 10;
Console.WriteLine(“___________________________________________________________________________________________________________________”);
Console.WriteLine(“Student Grade Is ” + points + ” Average Score”);
Console.WriteLine(“Student Grade Is In 70 – 80 Percentile Student Letter Grade ‘C'”);
Console.WriteLine(“”);
Console.WriteLine(“**********************************TERMINATING PROGRAM**************************************************************”);
Console.WriteLine(“Thank You for Using the Student Grade Calculator”);
Console.ReadLine();
}
else if (points >= 600 && points <= 700)
{
points = points / 10;
Console.WriteLine(“___________________________________________________________________________________________________________________”);
Console.WriteLine(“Student Grade Is ” + points + ” Below Average Score”);
Console.WriteLine(“Student Grade Is In 60 – 70 Percentile Student Letter Grade ‘D'”);
Console.WriteLine(“”);
Console.WriteLine(“********************************TERMINATING PROGRAM***************************************************************”);
Console.WriteLine(“Thank You For using The Student Grade Calculator”);
Console.ReadLine();
}
else if (points >= 0 && points <= 600)
{
points = points / 10;
Console.WriteLine(“_____________________________________________________________________________________________________________________”);
Console.WriteLine(“Student Grade Is ” + points + ” Failing Score”);
Console.WriteLine(“Student Grade is Below 60 Percentile Student Grade Is ‘F'”);
Console.WriteLine();
Console.WriteLine(“*********************************TERMINATING PROGRAM*****************************************************************”);
Console.WriteLine(“Thank You For using the Student Grade Calculator”);
Console.ReadLine();
return;
}
if (points < 0 || points > 1000)
{
points = points / 10;
Console.WriteLine(“____________________________________________________________________________________________________________________”);
Console.WriteLine(points + ” THIS IS NOT A VALID SCORE PLEASE RE-ENTER STUDENT SCORE”);
Console.WriteLine(“Thank You For Using the Student Grade calculator Program”);
}
Console.ReadLine();
}
}
- }