C# Program Create a class student with a data members name and calculate marks and percentage.

C# Program Create a class student with a data member’s name and calculate marks and percentage.

Create a class student with a data members name and calculate marks and percentage.

Object:

C# Program Create a class student with a data member name, age, marks of English, marks of math, marks of science, total marks, obtained marks and percentage provide member functions CalculateTotalMarks and CalculatePercentage to calculate marks and percentage in main. C# Projects with Source Code

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lab_3a
{
class students
{
public void data()
{
string name;
int age;
double eng, math, sci, obt_marks, total_marks=300, per;
Console.WriteLine(“Enter Student Name: “);
name=Console.ReadLine();
Console.WriteLine(“Enter Student Age: “);
age = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“Enter Marks of English: “);
eng = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(“Enter Marks of Math: “);
math = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(“Enter Student Science: “);
sci = Convert.ToDouble(Console.ReadLine());
obt_marks = eng + math + sci;
per = (obt_marks / total_marks) * 100;
Console.WriteLine(“——————————————\n\n”);
Console.WriteLine(“Name of Student is: {0}”, name);
Console.WriteLine(“Student Age is : {0}”, age);
Console.WriteLine(“Obtained Marks : {0}”, obt_marks);
Console.WriteLine(“Percentage : {0}”, per);
}
}
class Program
{
static void Main()
{
students i = new students();
i.data();
Console.ReadKey();
}
}
}

Output:

C# Program Create a class student with a data members name and calculate marks and percentage.

Another Program: C# Program Calculating the Area of a Rectangle

Another Program: C# Program that Subtracts two user-defined numbers

M.A Siddiqui

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

3 Responses

  1. September 4, 2020

    […] Another C# Program: C# Program Create a class student with a data members name and calculate marks … […]

  2. September 4, 2020

    […] Another C# Program: C# Program Create a class student with a data members name and calculate marks … […]

  3. September 4, 2020

    […] Another C# Program: C# Program Create a class student with a data members name and calculate marks a… […]

Leave a Reply

Your email address will not be published. Required fields are marked *