Professional Documents
Culture Documents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace grade_calc
{
class Program
{
public static int subsel = 0;
static void percset(string e)
{
if (e == "1" || e == "2" || e == "5" || e == "6" || e == "10")
{
calculator.ww += .3;
calculator.pt += .5;
}
else if (e == "4" || e == "3")
{
calculator.ww += .4;
calculator.pt += .4;
}
else if (e == "7" || e == "8" || e == "9")
{
calculator.ww += .2;
calculator.pt += .6;
}
else if (e == "0")
{
calculator.ww *= 0;
calculator.pt *= 0;
}
}
static void Main(string[] args)
{
/*Console.WriteLine(subject.eng);
int a = Convert.ToInt32(Console.ReadLine());
subject.eng += a;
int b = subject.eng;
Console.WriteLine(b);
Console.ReadLine();
subject.Cox();
int c = Convert.ToInt32(Console.ReadLine());
percset(Convert.ToString(c));
calculator.Calc();*/
Console.WriteLine("=============================================");
Console.WriteLine(" Grade Calculator V2.0");
Console.WriteLine("=============================================");
Console.WriteLine(" ");
Console.ReadKey();
int rdr1 = 0;
while (rdr1 == 0)
{
subject.subno();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
Console.WriteLine("Choose from the Options");
Console.WriteLine("1) Calculate Grades [Grades calculated: {0}]",
subject.sno);
Console.WriteLine("2) Calculate Average");
Console.WriteLine("3) Exit");
Console.WriteLine("=============================================");
Console.WriteLine("[Press your selected number]");
Console.WriteLine();
int rdr2 = 0;
while (rdr2 == 0)
{
ConsoleKeyInfo key1;
key1 = Console.ReadKey(true);
if (key1.Key == ConsoleKey.D1 || key1.Key ==
ConsoleKey.NumPad1)
{
int rdr3 = 0;
while (rdr3 == 0)
{
subsel *= 0;
percset("0");
rdr2 += 1;
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
Console.WriteLine("Choose which subject to calculate");
extra.subcalced("1");
extra.subcalced("2");
extra.subcalced("3");
extra.subcalced("4");
extra.subcalced("5");
extra.subcalced("6");
extra.subcalced("7");
extra.subcalced("8");
extra.subcalced("9");
extra.subcalced("10");
Console.WriteLine("=============================================");
Console.WriteLine("ESC) Menu");
Console.WriteLine("[Press your selected number]");
Console.WriteLine();
int rdr4 = 0;
while (rdr4 == 0)
{
ConsoleKeyInfo key2;
key2 = Console.ReadKey(true);
percset("1");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D2 || key2.Key ==
ConsoleKey.NumPad2)
{
subsel += 2;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("2");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D3 || key2.Key ==
ConsoleKey.NumPad3)
{
subsel += 3;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("3");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D4 || key2.Key ==
ConsoleKey.NumPad4)
{
subsel += 4;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("4");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D5 || key2.Key ==
ConsoleKey.NumPad5)
{
subsel += 5;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("5");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D6 || key2.Key ==
ConsoleKey.NumPad6)
{
subsel += 6;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("6");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D7 || key2.Key ==
ConsoleKey.NumPad7)
{
subsel += 7;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("7");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D8 || key2.Key ==
ConsoleKey.NumPad8)
{
subsel += 8;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("8");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D9 || key2.Key ==
ConsoleKey.NumPad9)
{
subsel += 9;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("9");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.D0 || key2.Key ==
ConsoleKey.NumPad0)
{
subsel += 10;
extra.con *= 0;
extra.confirm();
if (extra.con == 1)
{
rdr4 += 1;
rdr3 += 1;
percset("10");
calculator.Calc();
}
else if (extra.con == 2)
{
rdr4 += 1;
}
}
else if (key2.Key == ConsoleKey.Escape || key2.Key ==
ConsoleKey.Backspace)
{
rdr3 += 1;
rdr4 += 1;
}
}
}
}
else if (key1.Key == ConsoleKey.D2 || key1.Key ==
ConsoleKey.NumPad2)
{
rdr2 += 1;
if (subject.sno != 0)
{
subject.subavg();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
Console.WriteLine("Your Average is {0}",
subject.totalavg);
Console.WriteLine("=============================================");
Console.WriteLine();
Console.ReadKey();
}
else if (subject.sno == 0)
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
Console.WriteLine("You haven't calculated anything
yet.");
Console.WriteLine("=============================================");
Console.WriteLine();
Console.ReadKey();
Console.WriteLine("bozo");
}
}
else if (key1.Key == ConsoleKey.D3 || key1.Key ==
ConsoleKey.NumPad3)
{
rdr1 += 1;
rdr2 += 1;
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace grade_calc
{
public static class subject
{
public static int esp = 0;
public static int eng = 0;
public static int sci = 0;
public static int mat = 0;
public static int fil = 0;
public static int ss = 0;
public static int com = 0;
public static int map = 0;
public static int tle = 0;
public static int qh = 0;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace grade_calc
{
public static class calculator
{
public static double ww = 0;
public static double pt = 0;
public static double qt = .2;
public static int gradetotal = 0;
}
else if (key2.Key == ConsoleKey.N)
{
yn2 += 1;
}
}
}
else if (key1.Key == ConsoleKey.N)
{
yn1 += 1;
}
}
double wwht = wwh1 + wwh2 + wwh3;
double wwst = wws1 + wws2 + wws3;
Double wwpt = Math.Round((wwst / wwht) * 100,2);
Double wwpg = Math.Round(wwpt * ww,2);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("You got a total score of {0}/{1} with a percentage
of {2}%, and makes up {3}% of your grade.",wwst,wwht,wwpt,wwpg);
Console.WriteLine("[Press any key to continue]");
Console.WriteLine();
Console.ReadKey();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
Console.WriteLine("Performance Tasks");
Console.WriteLine("=============================================");
Console.WriteLine();
Console.WriteLine("Input the Highest Possible Score for the First
Performance Task");
extra.Input(7);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Input your Score for the First Performance Task");
extra.Input(8);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Is there a second Performance Task?");
Console.Write("[Y/N]");
int yn3 = 0;
while (yn3 == 0)
{
ConsoleKeyInfo key3;
key3 = Console.ReadKey(true);
if (key3.Key == ConsoleKey.Y)
{
yn3 += 1;
Console.WriteLine();
Console.WriteLine("Input the Highest Possible Score for the
Second Performance Task");
extra.Input(9);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Input your Score for the Second Performance
Task");
extra.Input(10);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Is there a third Performance Task?");
Console.Write("[Y/N]");
int yn4 = 0;
while (yn4 == 0)
{
ConsoleKeyInfo key4;
key4 = Console.ReadKey(true);
if (key4.Key == ConsoleKey.Y)
{
yn4 += 1;
Console.WriteLine();
Console.WriteLine("Input the Highest Possible Score for
the Third Performance Task");
extra.Input(11);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Input your Score for the Third
Performance Task");
extra.Input(12);
}
else if (key4.Key == ConsoleKey.N)
{
yn4 += 1;
}
}
}
else if (key3.Key == ConsoleKey.N)
{
yn3 += 1;
}
}
double ptht = pth1 + pth2 + pth3;
double ptst = pts1 + pts2 + pts3;
Double ptpt = Math.Round((ptst / ptht) * 100, 2);
Double ptpg = Math.Round(ptpt * pt, 2);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("You got a total score of {0}/{1} with a percentage
of {2}%, and makes up {3}% of your grade.", ptst, ptht, ptpt, ptpg);
Console.WriteLine("[Press any key to continue]");
Console.WriteLine();
Console.ReadKey();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
Console.WriteLine("Quarterly Exams");
Console.WriteLine("=============================================");
Console.WriteLine();
Console.WriteLine("Input the Highest Possible Score for the Test ");
extra.Input(13);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Input your Score for the Test");
extra.Input(14);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Is there a second Test?");
Console.Write("[Y/N]");
int yn5 = 0;
while (yn5 == 0)
{
ConsoleKeyInfo key5;
key5 = Console.ReadKey(true);
if (key5.Key == ConsoleKey.Y)
{
yn5 += 1;
Console.WriteLine();
Console.WriteLine("Input the Highest Possible Score for the
Second Test");
extra.Input(15);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Input your Score for the Second Test");
extra.Input(16);
}
else if (key5.Key == ConsoleKey.N)
{
yn5 += 1;
}
}
double qtht = qth1 + qth2;
double qtst = qts1 + qts2;
Double qtpt = Math.Round((qtst / qtht) * 100, 2);
Double qtpg = Math.Round(qtpt * qt, 2);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("You got a total score of {0}/{1} with a percentage
of {2}%, and makes up {3}% of your grade.", qtst, qtht, qtpt, qtpg);
Console.WriteLine("[Press any key to continue]");
Console.WriteLine();
Console.ReadKey();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace grade_calc
{
public static class extra
{
/*public static int chosen = 0;
public static void choices(string a)
{
if (a == "1" || a == "1 " || a == "Calculate Grades" || a == "calculate
grades" || a == "Calculate grades" || a == "calculate Grades" || a ==
"CalculateGrades" || a == "calculategrades" || a == "Calculategrades" || a ==
"calculateGrades")
{
chosen += 1;
}
else if (a == "2" || a == "2 " || a == "Calculate Average" || a ==
"calculate average" || a == "Calculate average" || a == "calculate Average" || a ==
"CalculateAverage" || a == "calculateaverage" || a == "Calculateaverage" || a ==
"calculateAverage" )
{
chosen += 2;
}
}*/
public static void subcalced(string a)
{
if (a == "1")
{
if (subject.esp == 0)
{
Console.WriteLine("1) ESP [Not Calculated]");
}
else if (subject.esp > 0)
{
Console.WriteLine("1) ESP [Calculated]");
}
}
else if (a == "2")
{
if (subject.eng == 0)
{
Console.WriteLine("2) English [Not Calculated]");
}
else if (subject.eng > 0)
{
Console.WriteLine("2) English [Calculated]");
}
}
else if (a == "3")
{
if (subject.sci == 0)
{
Console.WriteLine("3) Science [Not Calculated]");
}
else if (subject.sci > 0)
{
Console.WriteLine("3) Science [Calculated]");
}
}
else if (a == "4")
{
if (subject.mat == 0)
{
Console.WriteLine("4) Math [Not Calculated]");
}
else if (subject.mat > 0)
{
Console.WriteLine("4) Math [Calculated]");
}
}
else if (a == "5")
{
if (subject.fil == 0)
{
Console.WriteLine("5) Filipino [Not Calculated]");
}
else if (subject.fil > 0)
{
Console.WriteLine("5) Filipino [Calculated]");
}
}
else if (a == "6")
{
if (subject.ss == 0)
{
Console.WriteLine("6) Social Studies [Not Calculated]");
}
else if (subject.ss > 0)
{
Console.WriteLine("6) Social Studies [Calculated]");
}
}
else if (a == "7")
{
if (subject.com == 0)
{
Console.WriteLine("7) Computer [Not Calculated]");
}
else if (subject.com > 0)
{
Console.WriteLine("7) Computer [Calculated]");
}
}
else if (a == "8")
{
if (subject.map == 0)
{
Console.WriteLine("8) MAPEH [Not Calculated]");
}
else if (subject.map > 0)
{
Console.WriteLine("8) MAPEH [Calculated]");
}
}
else if (a == "9")
{
if (subject.tle == 0)
{
Console.WriteLine("9) TLE [Not Calculated]");
}
else if (subject.tle > 0)
{
Console.WriteLine("9) TLE [Calculated]");
}
}
else if (a == "10")
{
if (subject.qh == 0)
{
Console.WriteLine("10) Qatar History [Not Calculated]");
}
else if (subject.qh > 0)
{
Console.WriteLine("10) Qatar History [Calculated]");
}
}
}
public static void subnameentry()
{
switch (Program.subsel)
{
case 1:
Console.WriteLine(" ESP");
break;
case 2:
Console.WriteLine(" English");
break;
case 3:
Console.WriteLine(" Science");
break;
case 4:
Console.WriteLine(" Math");
break;
case 5:
Console.WriteLine(" Filipino");
break;
case 6:
Console.WriteLine(" Social Studies");
break;
case 7:
Console.WriteLine(" Computer");
break;
case 8:
Console.WriteLine(" MAPEH");
break;
case 9:
Console.WriteLine(" TLE");
break;
case 10:
Console.WriteLine(" Qatar History");
break;
}
}
public static void Input(int e)
{
string _val = "";
Console.Write("Enter your value: ");
ConsoleKeyInfo key;
do
{
key = Console.ReadKey(true);
if (key.Key != ConsoleKey.Backspace)
{
double val = 0;
bool _x = double.TryParse(key.KeyChar.ToString(), out val);
if (_x)
{
_val += key.KeyChar;
Console.Write(key.KeyChar);
}
}
else
{
if (key.Key == ConsoleKey.Backspace && _val.Length > 0)
{
_val = _val.Substring(0, (_val.Length - 1));
Console.Write("\b \b");
}
}
}
// Stops Receving Keys Once Enter is Pressed
while (key.Key != ConsoleKey.Enter);
switch (e)
{
case 1:
calculator.wwh1 *= 0;
calculator.wwh1 += Convert.ToDouble(_val);
break;
case 2:
calculator.wws1 *= 0;
calculator.wws1 += Convert.ToDouble(_val);
break;
case 3:
calculator.wwh2 *= 0;
calculator.wwh2 += Convert.ToDouble(_val);
break;
case 4:
calculator.wws2 *= 0;
calculator.wws2 += Convert.ToDouble(_val);
break;
case 5:
calculator.wwh3 *= 0;
calculator.wwh3 += Convert.ToDouble(_val);
break;
case 6:
calculator.wws3 *= 0;
calculator.wws3 += Convert.ToDouble(_val);
break;
case 7:
calculator.pth1 *= 0;
calculator.pth1 += Convert.ToDouble(_val);
break;
case 8:
calculator.pts1 *= 0;
calculator.pts1 += Convert.ToDouble(_val);
break;
case 9:
calculator.pth2 *= 0;
calculator.pth2 += Convert.ToDouble(_val);
break;
case 10:
calculator.pts2 *= 0;
calculator.pts2 += Convert.ToDouble(_val);
break;
case 11:
calculator.pth3 *= 0;
calculator.pth3 += Convert.ToDouble(_val);
break;
case 12:
calculator.pts3 *= 0;
calculator.pts3 += Convert.ToDouble(_val);
break;
case 13:
calculator.qth1 *= 0;
calculator.qth1 += Convert.ToDouble(_val);
break;
case 14:
calculator.qts1 *= 0;
calculator.qts1 += Convert.ToDouble(_val);
break;
case 15:
calculator.qth2 *= 0;
calculator.qth2 += Convert.ToDouble(_val);
break;
case 16:
calculator.qts2 *= 0;
calculator.qts2 += Convert.ToDouble(_val);
break;
}
}
public static int con = 0;
public static void confirm()
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("=============================================");
subnameentry();
Console.WriteLine("=============================================");
Console.WriteLine("Press Enter/Space to continue");
Console.WriteLine("Press ESC/Backspace to go back");
Console.WriteLine();
int rdr1 = 0;
while (rdr1 == 0)
{
ConsoleKeyInfo key1;
key1 = Console.ReadKey(true);
if (key1.Key == ConsoleKey.Enter || key1.Key ==
ConsoleKey.Spacebar)
{
rdr1 += 1;
con += 1;
}
else if (key1.Key == ConsoleKey.Backspace || key1.Key ==
ConsoleKey.Escape)
{
rdr1 += 1;
con += 2;
}
}
}
}
}