0% found this document useful (0 votes)
8 views3 pages

Student Result System in C# Code

The document contains a C# program that defines a 'Student' class to manage student academic records, including properties for student details and methods to calculate total marks, average marks, and grades. It also includes a 'Player' class with basic attributes for a game character. The main function creates a student instance and displays their total marks, average, grade, and details.

Uploaded by

bilalrehan013
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Student Result System in C# Code

The document contains a C# program that defines a 'Student' class to manage student academic records, including properties for student details and methods to calculate total marks, average marks, and grades. It also includes a 'Player' class with basic attributes for a game character. The main function creates a student instance and displays their total marks, average, grade, and details.

Uploaded by

bilalrehan013
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

using System;

using [Link];
using [Link];
using [Link];
using [Link];

namespace ClassLearning2
{
internal class Program
{
static void Main(string[] args)
{

Student student = new Student("2025-CS-82", "Abdullah", "CS", "2nd",


50, 50, 20, 10, 40);

[Link]([Link]());
[Link]([Link]());
[Link]("Gradue " + [Link]());
[Link]([Link]());
}
}
/*
Q1. Imagine you are designing a StudentResult system for a university. Create
a class that
represents a student’s academic records, such as studentId, name, department,
semester,
marksOfSubject1, marksOfSubject2, marksOfSubject3, marksOfSubject4, and
marksOfSubject5. Define functions in the class to perform the following
operations:
1. Calculate the total marks.
2. Calculate the average marks.
3. Determine the grade of the student.
4. Return the complete student result with all details.
*/
public class Student
{
public string id;
public string name;
public string department;
public string semester;
public int sub1;
public int sub2;
public int sub3;
public int sub4;
public int sub5;

public Student()
{

}
public Student(string id, string name, string department, string semester,
int sub1, int sub2, int sub3, int sub4, int sub5)
{
[Link] = id;
[Link] = name;
[Link] = department;
[Link] = semester;
this.sub1 = sub1;
this.sub2 = sub2;
this.sub3 = sub3;
this.sub4 = sub4;
this.sub5 = sub5;
}

public double TotalMarks()


{
double sum = sub1 + sub2 + sub3 + sub4 + sub5;

return sum;
}
public double Avg()
{
double avg = TotalMarks() / 5;
return avg;
}
public string Grade()
{
double avg = Avg();
if(avg > 90)
{
return "A";
}else if(avg <=90)
{
return "F";
}
else
{
return "A";
}
}
public string ToString()
{
return name +" "+department+" "+semester+" "+sub1+" "+sub2+" "+sub3+"
"+sub4+" "+sub5;
}
}

class Player
{
string name;
int damange;
int health;
int level;

public Player()
{
health = 100;
level = 1;
damange = 0;
}
public Player(string name)
{
[Link] = name;
health = 100;
level = 1;
damange = 0;
}
}
}

You might also like