A community college requires students to finish at least 72 credit hours and have a GPA of 2.0 or above in order to graduate. Create a C# console application to do the following. Ask how many credit hours a student has finished and what GPA this student has. Use only one if…else statement to decide and display whether this student can graduate or not. I believe I am missing something in regards to the 'gradePointAverage' integer. I am looking for it to accept the user's input of their GPA in the format of 'x.x' . When I input a non-decimal it works but it doesn't when I put in a decimal format. I tried creating a string or decimal but I have no clue right now. Advice and guidance will be very appreciated.
Here is what I have so far:
using System;
public class Question01
{
public static void Main(string[] args)
{
Console.WriteLine("Graduation Requirements");
Console.WriteLine("===========");
Console.WriteLine();
Console.Write("How many credit hours have you completed: ");
int creditHours;
creditHours = Convert.ToInt32(Console.ReadLine());
Console.Write("What is your current GPA: ");
int gradePointAverage;
gradePointAverage = Convert.ToInt32(Console.ReadLine());
if (creditHours >= 72 && gradePointAverage > (2.0))
{
Console.WriteLine("You're eligible to graduate!");
}
else
{
Console.WriteLine("You're not eligible to graduate, sorry.");
}
}
}