Advertisement
vvccs

EXP5

Apr 13th, 2024 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public class Student
  2. {
  3. public string Name { get; set; }
  4. public int Age { get; set; }
  5. public char Grade { get; set; }
  6.  
  7. public Student()
  8. {
  9. }
  10.  
  11. public Student(string name, int age, char grade)
  12. {
  13. Name = name;
  14. Age = age;
  15. Grade = grade;
  16. }
  17. }
  18. class Program
  19. {
  20. static void Main(string[] args)
  21. {
  22. Student student = new Student();
  23. Console.Write("Enter student's name: ");
  24. student.Name = Console.ReadLine();
  25. Console.Write("Enter student's age: ");
  26. student.Age = Convert.ToInt32(Console.ReadLine());
  27. Console.Write("Enter student's grade: ");
  28. student.Grade = Convert.ToChar(Console.ReadLine());
  29. Console.WriteLine("\nStudent Information:");
  30. Console.WriteLine("Name: " + student.Name);
  31. Console.WriteLine("Age: " + student.Age);
  32. Console.WriteLine("Grade: " + student.Grade);
  33. Console.ReadLine();
  34. }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement