Right, so basic problem. I'm designing a BTEC grade calculator, for those that are not in the know; BTEC is a type of qualification done in the UK and has a 'different' point grading system mainly based on coursework. There is a number of units (20) and each unit you can get a pass, merit and distinction on each unit. Each pass, merit and distinction add up to so many points and these points add up to the overall grade.
- BTEC Tariff Info
- DStar DStar DStar 420
- DStar DStar D 400
- DStar DD 380
- DDD 360
- DDM 320
- DMM 280
- MMM 240
- MMP 200
- MPP 160
- PPP 120
My problem is doing a mock up of a basic letter code print out is that with this BTEC system, I have no idea how to implement it; being a complete beginner at C# but knowing some basics.
Pseudo Code: Whats Your Name: - Name Enter your units: D M P D M P ( And the rest )
Your final grade is DMM
That's essentially what i need it to do is instead of putting 40 for a P I just want to put a P which would = 40 as such. This is my current code but it needs to be changed and fixed.
class Program
{
static void Main(string[] args)
{
int counter;
double score;
while (true)
{
counter = 1;
score = 0.0;
Console.WriteLine("Enter Your Name or type 'exit' to quit): ");
// Naming for exiting
string name = Console.ReadLine();
if (name == "exit")
{
Environment.Exit(0);
}
else
{
int numberOfUnits = 20;
Console.WriteLine("Number of Units: ");
numberOfUnits = int.Parse(Console.ReadLine());
while (counter <= numberOfUnits)
{
Console.WriteLine("Final Grade Score {0}", counter);
score += double.Parse(Console.ReadLine());
counter++;
}
// Add up and print letter grade.
score = (score / (counter - 1));
if (score < 120)
{
Console.WriteLine("Letter Grade: PPP");
}
else if (score < 160)
{
Console.WriteLine("Letter Grade: MPP");
}
else if (score < 200)
{
Console.WriteLine("Letter Grade: MMP");
}
else if (score < 240)
{
Console.WriteLine("Letter Grade: MMM");
}
else if (score < 280)
{
Console.WriteLine("Letter Grade: DMM");
}
else if (score < 320)
{
Console.WriteLine("Letter Grade: DDM");
}
else if (score < 360)
{
Console.WriteLine("Letter Grade: DDD");
}
// After DDD it goes up by 20's ..... D* = 20 not 40...
else if (score < 380)
{
Console.WriteLine("Letter Grade: D*DD");
}
else if (score < 400)
{
Console.WriteLine("Letter Grade: D*D*D");
}
else if (score < 420)
{
Console.WriteLine("Letter Grade: D*D*D*");
}
Console.WriteLine("Grade: {0}", (score).ToString("P"));
}
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire