Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp16
- {
- class Program
- {
- static void Main(string[] args)
- {
- Danni U1 = new Danni("Dimana", "XI", 5, 5, 6);
- double usp1 = U1.Avg();
- Console.WriteLine(U1.ime + " ima uspeh " + usp1);
- Danni U2 = new Danni("Yoanna", "XI", 2, 2, 6);
- double usp2 = U2.Avg();
- Console.WriteLine(U2.ime + " ima uspeh " + usp2);
- Danni U3 = new Danni("Stefan", "XI", 2, 2, 2);
- double usp3 = U3.Avg();
- Console.WriteLine(U3.ime + " ima uspeh " + usp3);
- }
- }
- class Danni
- {
- private string Ime;
- public string ime
- {
- get { return Ime; }
- set { Ime = value; }
- }
- private string Klas;
- public string klas
- {
- get { return Klas; }
- set { Klas = value; }
- }
- private int Bel;
- public int bel
- {
- get { return Bel; }
- set { Bel = value; }
- }
- private int Mat;
- public int mat
- {
- get { return Mat; }
- set { Mat = value; }
- }
- private int Inf;
- public int inf
- {
- get { return Inf; }
- set { Inf = value; }
- }
- public Danni(string ime, string klas, int bel, int mat, int inf)
- {
- this.ime = ime; this.klas = klas; this.bel = bel; this.mat = mat; this.inf = inf;
- }
- public double Avg()
- {
- return System.Math.Round((bel + mat + inf) / 3.0,2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement