In: Computer Science
1-Create a new Visual C# Console App (.NET Framework). Name the solution "GPA Calculation".
2-Zip and Submit your entire project with the solution file
GPA
Ask the user to input their grade percentage (e.g. the use will enter 98 if they had an overall grade of 98% in their course) for their Accounting, Marketing, Economics and MIS courses. Assume each course is worth 3 credit hours. Once you have all of their grades output what letter grade they earned for each course (e.g. Your letter grade for {Accounting/Marketing/whichever one you are outputting} is {A/B/C/D/F}). After you have output all of their letter grades, output their overall GPA for the semester using the formula:
A = 4.00
B = 3.00
C = 2.00
D = 1.00
F = 0.00
GPA = TOTAL POINTS EARNED / TOTAL POINTS ATTEMPTED
***I am really struggling with this program. If someone could help me figure out the simplest way to code it using loops, I would appreciate it. I have posted this question several times and keep getting strange things as a response. The program needs to convert the letter grade to the correlating point (example: A=4.00), then use those points to calculate the GPA and print it as the output. An example of the output should look like this.
"Please enter your grade, in percentage, for Accounting"
"Please enter your grade, in percentage, for Marketing"
"Please enter your grade, in percentage, for Economics"
"Please enter your grade, in percentage, for MIS"
(accept all inputs for the %)
"Your letter grade for Accounting is: "
"Your letter grade for Marketing is: "
"Your letter grade for Economics is: "
"Your letter grade for MIS is: "
(calculate GPA using the formula above)
"Your GPA is: "
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GPA_Calculation
{
class Program
{
static void Main(string[] args)
{
double AccountingGrade, MarketingGrade, EconomicsGrade,
MISgrade,GPA;
string letterGradeAccounting,letterGradeMarketing,
latterGradeEconomics, latterGradeMIS;
double totalPointsEarned = 0;
Console.Write("Please enter your grade, in percentage, for
Accounting: ");
AccountingGrade = Convert.ToDouble(Console.ReadLine());
Console.Write("Please enter your grade, in percentage, for
Marketing: ");
MarketingGrade = Convert.ToDouble(Console.ReadLine());
Console.Write("Please enter your grade, in percentage, for
Economics: ");
EconomicsGrade = Convert.ToDouble(Console.ReadLine());
Console.Write("Please enter your grade, in percentage, for MIS:
");
MISgrade = Convert.ToDouble(Console.ReadLine());
letterGradeAccounting = findLetterGrade(AccountingGrade);
letterGradeMarketing = findLetterGrade(MarketingGrade);
latterGradeEconomics = findLetterGrade(EconomicsGrade);
latterGradeMIS = findLetterGrade(MISgrade);
totalPointsEarned = 3 * findGragePoint(letterGradeAccounting) +
3 * findGragePoint(letterGradeMarketing) + 3 *
findGragePoint(latterGradeEconomics) + 3 *
findGragePoint(latterGradeMIS);
GPA = totalPointsEarned / 12.0;
Console.WriteLine("\n\nYour letter grade for Accounting is: " +
letterGradeAccounting);
Console.WriteLine("Your letter grade for Marketing is: " +
letterGradeMarketing);
Console.WriteLine("Your letter grade for Economics is: " +
latterGradeEconomics);
Console.WriteLine("Your letter grade for MIS is: " +
latterGradeMIS);
Console.WriteLine("Your GPA is: " + GPA);
}
public static string findLetterGrade(double grade)
{
if (grade >= 90.00)
return "A";
else if (grade >= 80.00 && grade <= 89.99)
return "B";
else if (grade >= 70.00 && grade <= 79.99)
return "C";
else if (grade >= 60.00 && grade <= 69.99)
return "D";
return "F";
}
public static int findGragePoint(string latterGrade)
{
if (latterGrade == "A")
return 4;
else if (latterGrade == "B")
return 3;
else if (latterGrade == "C")
return 2;
else if (latterGrade == "D")
return 1;
return 0;
}
}
}
output
If you have any query regarding the code please ask me in the
comment i am here for help you. Please do not direct thumbs down
just ask if you have any query. And if you like my work then please
appreciates with up vote. Thank You.