Anurag
student marks program
Anurag
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace student_marks
{
class studentprofile
{
static void Main(string[] args)
{
//int subject1, subject2, subject3, subject4, subject5, subject6, total;
//double percentage;
char option;
Console.WriteLine("-------Welcome to percentage and grade calculator of SSLC 2017-------");
Console.WriteLine("\nPlease enter your name");
string UserName = Console.ReadLine();
Console.Write("\nEnter the 1st Language Marks ");
int subject1 = Convert.ToInt32(Console.ReadLine());
if(subject1 < 44)
{
option = '5';
//Console.Write("\nThe student has failed in 1st language");
}
Console.Write("\nEnter the 2nd Language Marks ");
int subject2 = Convert.ToInt32(Console.ReadLine());
if(subject2 < 35)
{
option = '5';
//Console.Write("\nThe student has failed in 2nd language");
}
Console.Write("\nEnter the 3rd Language Marks ");
int subject3 = Convert.ToInt32(Console.ReadLine());
if(subject3 < 35)
{
option = '5';
//Console.Write("\nThe student has failed in 3rd language");
}
Console.Write("\nEnter the MATHEMATICS Marks ");
int subject4 = Convert.ToInt32(Console.ReadLine());
if(subject4 < 35)
{
option = '5';
//Console.Write("\nThe student has failed in MATHEMATICS");
}
Console.Write("\nEnter the SCIENCE Marks ");
int subject5 = Convert.ToInt32(Console.ReadLine());
if(subject5 < 35)
{
option = '5';
//Console.Write("\nThe student has failed in SCIENCE");
}
Console.Write("\nEnter the SOCIAL STUDIES Marks ");
int subject6 = Convert.ToInt32(Console.ReadLine());
if(subject6 < 35)
{
option = '5';
//Console.Write("\nThe student has failed in SOCIAL STUDIES");
}
int[] sub = new int[5];
sub[0] = subject1;
sub[1] = subject2;
sub[2] = subject3;
sub[3] = subject4;
sub[4] = subject5;
sub[5] = subject6;
studentprofile sp = new studentprofile();
int total = sp.Add(subject1,subject2,subject3,subject4,subject5,subject6);
double percentage = sp.percentage(total);
if (percentage > 85)
{
option = '1';
}
else if (percentage < 85 && percentage > 60)
{
option = '2';
}
else if (percentage < 60 && percentage > 50)
{
option = '3';
}
else if (percentage < 50 && percentage >= 35)
{
option = '4';
}
else
{
option = '5';
}
Console.WriteLine("\nThe total marks, percentage and grade of Student {0} is", UserName);
Console.WriteLine("\nTOTAL MARKS : {0}", total);
Console.WriteLine("\nPERCENTAGE : {0}", percentage);
switch (option)
{
case '1':
Console.WriteLine("\nGrade: First Class with Distinction");
break;
case '2':
Console.WriteLine("\nGrade: First Class");
break;
case '3':
Console.WriteLine("\nGrade: Second Class");
break;
case '4':
Console.WriteLine("\nGrade: Third Class");
break;
case '5':
Console.WriteLine("\nSorry you are FAILED");
break;
default:
Console.WriteLine("\nInvalid GRADE");
break;
}
Console.ReadLine();
}
public int Add(int subject1, int subject2, int subject3, int subject4, int subject5, int subject6)
{
return subject1 + subject2 + subject3 + subject4 + subject5 + subject6;
}
public double percentage(int total)
{
return ((total/625f)*100);
}
}
}


Tapan PatelPosted Mar 28, 2017, 11:26 AM
Anurag GnPosted Mar 28, 2017, 11:21 AM
Tapan PatelPosted Mar 28, 2017, 10:50 AM
Anurag GnPosted Mar 28, 2017, 10:49 AM
Tapan PatelPosted Mar 28, 2017, 10:48 AM