Answer to Question #180383 in C# for Sparrow

Question #180383

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.


1
Expert's answer
2021-04-11T13:03:33-0400
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();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS