Answer to Question #188137 in C# for CHANDRASENA REDDY

Question #188137

St. Joseph school planned to create a system to store the records of students studying in their school. They need to store various kinds of data about their students. Write a C# program based on the class diagram given below and initialize the variables with proper values and print it


SCHOOL DEMO:

rollNumber : int

studentName : string

age : bytr

gender : char

dateOfBirth : DateTime

address : string

precentage : float


1
Expert's answer
2021-05-03T17:07:03-0400
using System;
					
public class Program
{
	public static void Main()
	{
		//Create object of type SCHOOL_DEMO
		SCHOOL_DEMO sd = new SCHOOL_DEMO();
		//Invoke display method
		sd.display();
	}
}
//Crate the class
class SCHOOL_DEMO
{
	//Create student data and initialize them
	private int rollNumber = 20000;
	private String studentName = "John Doe";
	private byte age = 15;
	private char gender = 'M';
	DateTime dateOfBirth = new DateTime(2006,05,09);
	private String address = "36 Sherwood Street Horn Lake, MS 38637";
	private float percentage = 88.70F;
	
	//Display student information
	public void display()
	{
		Console.WriteLine("========Student Summary========");
		Console.WriteLine("Roll Number: {0}", this.rollNumber );
		Console.WriteLine("Student Name: {0}" , this.studentName );
		Console.WriteLine("Age: {0}" , this.age );
		Console.WriteLine("Gender: "+ this.gender );
		Console.WriteLine("DoB: "+ this.dateOfBirth.ToShortDateString() );
		Console.WriteLine("Address: "+ this.address);
		Console.WriteLine("Percentage: {0}% ", this.percentage );
	}
}

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
New on Blog
APPROVED BY CLIENTS