Create a class to store details of student like roll no, name, and course joined and fee paid so far. Assume courses are C# and ASP.NET with course fees being 2000 and 3000.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Q180383
{
class Program
{
class Student {
private int rollNo;
private string name;
private string courseJoined;
private double feePaidFar;
/// <summary>
/// Constructor
/// </summary>
public Student() { }
/// <summary>
/// Constructor
/// </summary>
/// <param name="rollNo"></param>
/// <param name="name"></param>
/// <param name="courseJoined"></param>
/// <param name="feePaidFar"></param>
public Student(int rollNo, string name, string courseJoined, double feePaidFar) {
this.rollNo = rollNo;
this.name = name;
this.courseJoined = courseJoined;
this.feePaidFar = feePaidFar;
}
/// <summary>
/// display info
/// </summary>
public void display() {
Console.WriteLine("Roll No: {0}",rollNo);
Console.WriteLine("Name: {0}", name);
Console.WriteLine("Course joined: {0}", courseJoined);
Console.WriteLine("Fee paid so far: {0}", feePaidFar);
}
}
static void Main(string[] args)
{
Student studentMary=new Student(4546,"Mary","C#",2000);
Student studentMike = new Student(2131, "Mike", " ASP.NET", 3000);
studentMary.display();
Console.WriteLine();
studentMike.display();
Console.ReadLine();
}
}
}
Comments
Leave a comment