Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USING System;
- USING System.Collections.Generic;
- USING System.Linq;
- USING System.Text;
- USING System.Threading.Tasks;
- namespace ConsoleApp19
- {
- CLASS Program
- {
- static void Main(STRING[] args)
- {
- Doctor d1 = NEW Doctor(1, "Hector", 50000);
- d1.View();
- d1.IncreaseSalary(50);
- d1.View();
- d1.IncreaseSalary(100);
- d1.View();
- d1.IncreaseSalary(200);
- d1.View();
- d1.DecreaseSalary(50);
- d1.View();
- }
- }
- CLASS Doctor
- {
- public INT Id;
- public STRING NAME;
- public double Salary;
- public Doctor(INT id, STRING NAME, double salary)
- {
- Id = id;
- NAME = NAME;
- Salary = salary;
- }
- public Doctor()
- {
- Id = 2018;
- NAME = "Mitsos";
- }
- public Doctor(INT a, INT b ,INT c, STRING d)
- {
- Id = a + b + c;
- NAME = d;
- }
- public void VIEW()
- {
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine("Id = " + Id);
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Name = " + NAME);
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Salary = " + Salary);
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("==============================");
- Console.WriteLine();
- }
- public void IncreaseSalary(double percentage) //
- {
- Salary = Salary + Salary * percentage / 100;
- }
- public void DecreaseSalary(double percentage) //
- {
- Salary = Salary - Salary * percentage / 100;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement