Thursday 30 August 2012

Student program | using grade code | find out student grade

How to write C# student program  using  grade code

namespace result
{
class stud
{
public int roll, total, avg, dbms, c, cpp, vb;
string name, grade;

public void getdata()
{
Console.WriteLine("Enter roll no.:");
roll = int.Parse(Console.ReadLine());

Console.WriteLine("Enter name:");
name = Console.ReadLine();

Console.WriteLine("Enter marks in DBMS:");
dbms = int.Parse(Console.ReadLine());

Console.WriteLine("Enter marks in C:");
c = int.Parse(Console.ReadLine());

Console.WriteLine("Enter marks in CPP:");
cpp = int.Parse(Console.ReadLine());

Console.WriteLine("Enter marks in VB:");
vb = int.Parse(Console.ReadLine());
}

public void putdata()
{
total = (dbms + c + cpp + vb);
avg = total / 4;

if (avg >= 70)
grade = "distinction";
else if (avg >= 60)
grade = "first class";
else if (avg >= 50)
grade = "second class";
else if (avg >= 40)
grade = "Pass class";
else
grade = "Fail";

Console.WriteLine("Roll No: " + roll);
Console.WriteLine("Name: " + name);
Console.WriteLine("Marks in DBMS: " + dbms);
Console.WriteLine("Marks in C: " + c);
Console.WriteLine("Marks in CPP: " + cpp);
Console.WriteLine("Marks in VB: " + vb);
Console.WriteLine("Total: " + total);
Console.WriteLine("Average: " + avg);
Console.WriteLine("Grade: " + grade);
}

static void Main(string[] args)
{
stud ob = new stud();
ob.getdata();
ob.putdata();
console.readline();
}
}
}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: