Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

using System;

namespace Student_Konstruktori
{
class Program
{
public class Student
{
private string name;
private int clas;
private bool stip;

public string Name


{
set { this.name = value; }
get { return this.name; }
}

public int Clas


{
set { this.clas = value; }
get { return this.clas; }
}

public bool Stip


{
set { this.stip = value; }
get { return this.stip; }
}

public Student()
{
this.name = null;
this.clas = 0;
this.stip = false;
}

public Student(string a, int b, bool c)


{
this.name = a;
this.clas = b;
this.stip = c;
}

public Student(string a, int b)


{
this.name = a;
this.clas = b;
}
public void Print()
{
Console.WriteLine();
Console.WriteLine("Name: " + this.name);
Console.WriteLine("Class: " + this.clas);
Console.WriteLine("Stipendia: " + this.stip);
}
public void PrintSled()
{
if (this.stip) Console.WriteLine("Name: " + this.name); //tezi
koito imat stipendia
}
}

static void Main(string[] args)


{
Student Ivan = new Student("Ivan", 10, true);
Student Maria = new Student("Maria", 2, true);
Student Kaloyan = new Student("Kaloyan", 7, false);

Ivan.Print();
Maria.Print();
Kaloyan.Print();

Console.WriteLine(); //otpechatva nakraya


Ivan.PrintSled();
Maria.PrintSled();
Kaloyan.PrintSled();
}
}
}

You might also like