Public class
Download 21.59 Kb.
|
Bahodirxo\'ja 1
20. Name, Maosh va EmploymentType xususiyatlariga ega Xodim nomli sinf yarating. Xususiyatlar uchun olish va o‘rnatish bloklarini amalga oshiring. Xodimning ish turiga qarab oylik maoshini qaytaradigan GetMonthlySalary() usulini qo`shing. namespace Bahodir; public class Xodim { public string Name { get; set; } public decimal Maosh { get; set; } public string EmploymentType { get; set; } public decimal GetMonthySalary() { if (EmploymentType == null) Maosh = 0; else if (EmploymentType == "Programmer") Maosh = 1000; else if (EmploymentType == "QA") Maosh = 700; return Maosh; } } using Bahodir; Xodim User1 = new Xodim() { Name = "Bahodir", EmploymentType = "QA" }; User1.GetMonthySalary(); Console.WriteLine("Name : " + User1.Name + "\nEmploymentType : " + User1.EmploymentType + "\nSalary : " + User1.Maosh); Download 21.59 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling