[go: up one dir, main page]

0% found this document useful (0 votes)
11 views3 pages

Class and Object

The document is a C# program that implements a simple class for managing student details. It allows users to enter and display information such as student registration number, name, course name, and date of birth for two students. The program demonstrates the use of classes and objects in C#.

Uploaded by

devtvpurpose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Class and Object

The document is a C# program that implements a simple class for managing student details. It allows users to enter and display information such as student registration number, name, course name, and date of birth for two students. The program demonstrates the use of classes and objects in C#.

Uploaded by

devtvpurpose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Classandobjectapplication
{
class Student
{
public string[] studrn = new string[5];
public int[] day = new int[5];
public int[] month = new int[5];
public int[] year = new int[5];
public string[] name = new string[5];
public string[] cname = new string[5];
public void details()
{
Console.WriteLine("Implementation of Classes and Objects");
Console.WriteLine("****************************************");
Console.WriteLine("Enter student details and you can view these details");
Console.WriteLine("****************************************");
}
}
class Mainmethod
{
static void Main(string[] args)
{
Student s = new Student();
s.details();
int i;
for (i = 0; i < 2; i++)
{
Console.Write("Enter student reg no:");
s.studrn[i] = Console.ReadLine();
Console.Write("Enter student name:");
s.name[i] = Console.ReadLine();
Console.Write("Enter course name:");
s.cname[i] = Console.ReadLine();
Console.Write("Enter date:");
s.day[i] = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter month(1-12):");
s.month[i] = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter year:");
s.year[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n\nStudent's List\n");
for (i = 0; i < 2; i++)
{
Console.WriteLine("\nStudent ID : " + s.studrn[i]);
Console.WriteLine("\nStudent name : " + s.name[i]);
Console.WriteLine("\nCourse name : " + s.cname[i]);
Console.WriteLine("\ndate of birth(dd-mm-yy) : " + s.day[i] + "-" + s.month[i] + "-" +
[Visual Programming Lab] Page 3
s.year[i]);
}
Console.ReadKey();
}}}

You might also like