static void Main(string[] args) { Random random = new Random(); Student student = new Student("Karan",random.Next(1,Int32.MaxValue),"Manno",new int[]{76,65,58,70,69},"ABCInstitute",6); student.PrintAllDetails(); student.print(3); Console.ReadKey(); }
static void Main(string[] args) { Student s1 = new Student(17, "Shubham", 12, "M"); Console.WriteLine("\t\t Welcome to Boys School"); Console.WriteLine("\t\t Student details are"); s1.print(); Console.WriteLine("\t\t Options for specific details"); Console.WriteLine("\t\t\t{0}. For age", (int)StudentAttribute.age); Console.WriteLine("\t\t\t{0}. For name", (int)StudentAttribute.name); Console.WriteLine("\t\t\t{0}. For age", (int)StudentAttribute.clas); Console.WriteLine("\t\t\t{0}. For gender", (int)StudentAttribute.gender); Console.WriteLine("\t\t\t{0}. For roll no", (int)StudentAttribute.rollNo); Console.Write("\t\t Please Enter your choice: "); int ch = int.Parse(Console.ReadLine()); s1.print(ch); }
static void Main(string[] args) { /// <summary> /// Object of Random class to generate student enrolment no /// </summary> Random StudentEnrolmentNos = new Random(); /// <summary> /// variable to store student details /// </summary> string StudentName; int StudentAge; int StudentEnrolmentNo; int StudentMobileNo; /// <summary> /// Take user Input for Student detail /// </summary> Console.WriteLine(EnterStudentDetail); /// <summary> /// Enter Student Name /// </summary> Console.WriteLine(EnterStudentName); StudentName = Console.ReadLine(); /// <summary> /// Enter Student Age /// </summary> Console.WriteLine(EnterStudentAge); StudentAge = int.Parse(Console.ReadLine()); /// <summary> /// Enter Student Student Mobile No /// </summary> Console.WriteLine(EnterStudentMobileNo); StudentMobileNo = int.Parse(Console.ReadLine()); /// <summary> /// Take Student Enrolment No from Random class /// </summary> StudentEnrolmentNo = StudentEnrolmentNos.Next(); /// <summary> /// Call Parametrize constructor of Student Class to create object /// </summary> Student objStudent = new Student(StudentName, StudentAge, StudentEnrolmentNo, StudentMobileNo); /// <summary> /// Call Student Class's PrintStudentDetail method to print Student Details /// </summary> objStudent.Print(); /// <summary> /// Enter uour choice to print specific details /// </summary> Console.WriteLine(PrintChoice); /// <summary> /// variable to save choice of user to print specific detail of student /// </summary> int Choice = Int32.Parse(Console.ReadLine()); /// <summary> /// call print method of student class to print a specific detail about a student /// </summary> objStudent.print(Choice); Console.ReadLine(); }