Add project files.
This commit is contained in:
parent
629216cd85
commit
e99c0805d2
25
GPA Calculator.sln
Normal file
25
GPA Calculator.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.1.31911.260
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GPA Calculator", "GPA Calculator\GPA Calculator.csproj", "{3A401574-8EE0-4BE0-A38A-4F44283D29C6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3A401574-8EE0-4BE0-A38A-4F44283D29C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3A401574-8EE0-4BE0-A38A-4F44283D29C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3A401574-8EE0-4BE0-A38A-4F44283D29C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3A401574-8EE0-4BE0-A38A-4F44283D29C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {8DBB1FCB-D387-4A6E-A9FA-5FE3556E0774}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
9
GPA Calculator/GPA Calculator.csproj
Normal file
9
GPA Calculator/GPA Calculator.csproj
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<RootNamespace>GPA_Calculator</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
64
GPA Calculator/Program.cs
Normal file
64
GPA Calculator/Program.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace GPA_Calculator
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
static List<Grade> GradesList = new List<Grade>();
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
|
||||||
|
string inputGrade = string.Empty;
|
||||||
|
while (inputGrade != "q")
|
||||||
|
{
|
||||||
|
RenderGrades();
|
||||||
|
inputGrade = Console.ReadLine();
|
||||||
|
inputGrade = inputGrade.Replace("+", "Plus").Replace("-", "Minus");
|
||||||
|
if(Enum.TryParse<Grade>(inputGrade, out Grade grade))
|
||||||
|
{
|
||||||
|
GradesList.Add(grade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void RenderGrades()
|
||||||
|
{
|
||||||
|
Console.Clear();
|
||||||
|
Console.WriteLine("Enter a Grade:\t\t\tGrades:");
|
||||||
|
decimal totalGrade = 0;
|
||||||
|
foreach (var item in GradesList)
|
||||||
|
{
|
||||||
|
Console.WriteLine("\t\t\t\t" + item.ToString().Replace("Plus", "+").Replace("Minus", "-"));
|
||||||
|
totalGrade += (int)item;
|
||||||
|
}
|
||||||
|
if (GradesList.Count > 0)
|
||||||
|
{
|
||||||
|
Console.SetCursorPosition(0, 3);
|
||||||
|
Console.WriteLine("GPA: ");
|
||||||
|
Console.WriteLine(totalGrade / GradesList.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.SetCursorPosition(0, 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Grade
|
||||||
|
{
|
||||||
|
APlus = 9,
|
||||||
|
A = 8,
|
||||||
|
AMinus = 7,
|
||||||
|
BPlus = 6,
|
||||||
|
B = 5,
|
||||||
|
BMinus = 4,
|
||||||
|
CPlus = 3,
|
||||||
|
C = 2,
|
||||||
|
CMinus = 1,
|
||||||
|
Fail = 0,
|
||||||
|
F = 0,
|
||||||
|
D = 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user