a Write a console application that determine a student grade
a) Write a console application that determine a student grade given any mark the user decides to input.Your application should prompt the user to enter the score and then computes resulting grade. The grades are as follows: greater that or equal to 75 print distinction 65- 74 print uppersecond class 60- 64 print lowersecond class 50-59 print pass , otherwise fail (use vb.net)
Solution
/* I have calculated based on score of 3 subject and precentange.Hope this is fine as the question is not clear to me*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Marksheet1
{
class Program
{
static void Main(string[] args)
{
int m1, m2, m3, t;
float p;
string n;
Console.WriteLine(\"Enter Student Name :\");
n = Console.ReadLine();
Console.WriteLine(\"Mark of Subject1 : \");
m1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(\"Mark of Subject2 : \");
m2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(\"Mark of Subject3 : \");
m3 = Convert.ToInt32(Console.ReadLine());
t = m1 + m2 + m3;
p = t / 3.0f;
Console.WriteLine(\"Percentage : \" + p);
if (p >= 75 )
{
Console.WriteLine(\"Distinction\");
}
if (p >= 65 && p <= 74)
{
Console.WriteLine(\"UpperSecond\");
}
if (p >=60 && p <= 64)
{
Console.WriteLine(\"LowerSecond\");
}
if (p >= 50 && p <= 59)
{
Console.WriteLine(\"Grade is A+\");
}
if (p < 50)
{
Console.WriteLine(\"fail\");
}
Console.ReadLine();
}
}
}
