Advertisement
BojidarDosev

klas

Oct 17th, 2021
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp11
  8. {
  9.     class Program
  10.     {
  11.        
  12.         static void Main(string[] args)
  13.         {
  14.             Danni U1 = new Danni("Bojidar", "XI", 5, 5, 6);
  15.             double usp = U1.Avg();
  16.             Console.WriteLine(U1.ime + " ima uspeh " + usp);
  17.         }
  18.     }
  19.     class Danni
  20.     {
  21.         private string Ime;
  22.  
  23.         public string ime
  24.         {
  25.             get { return Ime; }
  26.             set { Ime = value; }
  27.         }
  28.         private string Klas;
  29.  
  30.         public string klas
  31.         {
  32.             get { return Klas; }
  33.             set { Klas = value; }
  34.         }
  35.         private int Ocenka1;
  36.  
  37.         public int ocenka1
  38.         {
  39.             get { return Ocenka1; }
  40.             set { Ocenka1 = value; }
  41.         }
  42.         private int Ocenka2;
  43.         public int ocenka2
  44.         {
  45.             get { return Ocenka2; }
  46.             set { Ocenka2 = value; }
  47.         }
  48.         private int Ocenka3;
  49.         public int ocenka3
  50.         {
  51.             get { return Ocenka3; }
  52.             set { Ocenka3 = value; }
  53.         }
  54.         public Danni(string ime, string klas, int ocenka1, int ocenka2, int ocenka3)
  55.         {
  56.             this.ime = ime;this.klas = klas;this.ocenka1 = ocenka1;this.ocenka2 = ocenka2;this.ocenka3 = ocenka3;
  57.         }
  58.         public double Avg()
  59.         {
  60.             return (ocenka1 + ocenka2 + ocenka3) / 3.0;
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement