I'm writing a program in C# for my structured programming class. These are the directions:
Write a program for a college's admissions office. The user enters a numeric high school grade point average (for example, 3.2) and an admission test score. Print the message "Accept" if the student meets either of the following requirements:
>> A grade point average of 3.0 or higher and an admission test score of at least 60
>> A grade point average of less than 3.0 and an admission test score of at least 80
If the student does not meet either of the qualification criteria, print "Reject". Save the program as Admission.cs.
Okay, now here's my source code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter your high school cumulative GPA.");
single gPA = Console.ReadLine();
Console.WriteLine("Please enter your admission test score.");
int testScore = Console.ReadLine();
if (gPA >= 3.0 && testScore >= 60) || (gPA < 3.0 && testScore >= 80)
Console.WriteLine("Accept");
else
Console.WriteLine("Reject");
}
}
}
I'm using Microsoft Visual Studio, and it's giving me four error messages. "Invalid expression term '||' (highlighting the || in my "if" statement), "; expected" (highlighting the blank space after the parenthesis after the "80" in my "if" statement), "Invalid expression term 'else'" (highlighting the word "else" in my "else" expression), and "; expected" again (highlighting the blank space after the word "else").
What am I doing wrong?