Advertisement
BojidarDosev

zad 5 dimana

Nov 21st, 2021
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp16
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. Danni U1 = new Danni("Dimana", "XI", 5, 5, 6);
  10. double usp1 = U1.Avg();
  11. Console.WriteLine(U1.ime + " ima uspeh " + usp1);
  12. Danni U2 = new Danni("Yoanna", "XI", 2, 2, 6);
  13. double usp2 = U2.Avg();
  14. Console.WriteLine(U2.ime + " ima uspeh " + usp2);
  15. Danni U3 = new Danni("Stefan", "XI", 2, 2, 2);
  16. double usp3 = U3.Avg();
  17. Console.WriteLine(U3.ime + " ima uspeh " + usp3);
  18. }
  19. }
  20. class Danni
  21. {
  22. private string Ime;
  23.  
  24. public string ime
  25. {
  26. get { return Ime; }
  27. set { Ime = value; }
  28. }
  29. private string Klas;
  30.  
  31. public string klas
  32. {
  33. get { return Klas; }
  34. set { Klas = value; }
  35. }
  36. private int Bel;
  37.  
  38. public int bel
  39. {
  40. get { return Bel; }
  41. set { Bel = value; }
  42. }
  43. private int Mat;
  44. public int mat
  45. {
  46. get { return Mat; }
  47. set { Mat = value; }
  48. }
  49. private int Inf;
  50.  
  51. public int inf
  52. {
  53. get { return Inf; }
  54. set { Inf = value; }
  55. }
  56. public Danni(string ime, string klas, int bel, int mat, int inf)
  57. {
  58. this.ime = ime; this.klas = klas; this.bel = bel; this.mat = mat; this.inf = inf;
  59. }
  60. public double Avg()
  61. {
  62. return System.Math.Round((bel + mat + inf) / 3.0,2);
  63. }
  64. }
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement