public virtual void Read(){
Console.WriteLine("Enter the name");
Console.WriteLine("Enter the age");
age=Convert.ToInt32(Console.ReadLine());
public int [] marks = new int[] {67,72,69,65,84,69,82};
protected float[] sgpa=new float[8];
public override void Read(){
throw new Exception("Student age cannot exceed 35");}
Console.WriteLine("Enter the rollno");
rollno=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the sem");
sem=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the branch");
branch=Console.ReadLine();
Console.WriteLine("Enter the sgpa of {0} sems",sem);
sgpa[i]=float.Parse(Console.ReadLine());
public float CalculateCGPA(){
public void PrintStudent(){
Console.WriteLine("name:{0}",base.name);
Console.WriteLine("branch:{0}",branch);
Console.WriteLine("cgpa:{0}",CalculateCGPA());
Console.WriteLine("rollno:{0}",rollno);
Console.Write(Convert.ToChar(marks[i]));
public override void Read(){
throw new Exception("wrong age");}
Console.WriteLine("Enter the facultyID");
facultyID=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the branch");
branch=Console.ReadLine();
Console.WriteLine("Enter the salary in lakhs");
salaryPerAnnum=Convert.ToDecimal(Console.ReadLine());
throw new Exception("salaray cannot be negative");}
public float CalculateIncomeTax(){
{return (float)salaryPerAnnum*0.3f;}
else if(salaryPerAnnum>5 && salaryPerAnnum<=10)
{return (float)salaryPerAnnum*0.1f;}
else if((float)salaryPerAnnum>2.5f && salaryPerAnnum<=5)
{return (float)salaryPerAnnum*0.05f;}
public void PrintFaculty(){
Console.WriteLine("faculty name:{0}",base.name);
Console.WriteLine("branch:{0}",branch);
Console.WriteLine("income tax:{0}Lakh",CalculateIncomeTax());
public static void Main()
Faculty[] f=new Faculty[100];
Student[] s=new Student[100];
Console.WriteLine("1.Faculty");
Console.WriteLine("2.Student");
ch=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("1.Enter details of N faculty");
Console.WriteLine("2.Retrive faculty detail");
Console.WriteLine("3.main menu");
ch2=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the number of faculties");
n=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("1.Enter details of N Student");
Console.WriteLine("2.Retrive all student detail");
Console.WriteLine("3.Retrive student detail based on student roll number");
Console.WriteLine("4.main menu");
ch2=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the number of student");
n=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the roll number of student");
ch=Convert.ToInt32(Console.ReadLine());
else{Console.WriteLine("Student not found");}