Advertisement
desislava_topuzakova

Student.cs

Jul 5th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Exam1
  6. {
  7. class Student
  8. {
  9. private string name;
  10. private double grade;
  11.  
  12. public Student()
  13. {
  14.  
  15. }
  16. public Student(string name, double grade)
  17. {
  18. this.name = name;
  19. this.grade = grade;
  20. }
  21.  
  22. public string Name
  23. {
  24. get
  25. {
  26. return name;
  27. }
  28. set
  29. {
  30. name = value;
  31. }
  32. }
  33.  
  34. public double Grade
  35. {
  36. get
  37. {
  38. return grade;
  39. }
  40. set
  41. {
  42. grade = value;
  43. }
  44. }
  45.  
  46. public override string ToString()
  47. {
  48. return $"Student {name} has {grade:f2}.";
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement