Advertisement
Tr22

Wage Salary

Feb 21st, 2020
2,210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USING System;
  2. USING System.Collections.Generic;
  3. USING System.Linq;
  4. USING System.Text;
  5. USING System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp19
  8. {
  9.     CLASS Program
  10.     {
  11.         static void Main(STRING[] args)
  12.         {
  13.             Doctor d1 = NEW Doctor(1, "Hector", 50000);
  14.             d1.View();
  15.  
  16.             d1.IncreaseSalary(50);
  17.  
  18.             d1.View();
  19.  
  20.             d1.IncreaseSalary(100);
  21.  
  22.             d1.View();
  23.  
  24.             d1.IncreaseSalary(200);
  25.  
  26.             d1.View();
  27.  
  28.             d1.DecreaseSalary(50);
  29.  
  30.             d1.View();
  31.  
  32.         }
  33.     }
  34.  
  35.     CLASS Doctor
  36.     {
  37.         public INT Id;
  38.         public STRING NAME;
  39.         public double Salary;
  40.  
  41.         public Doctor(INT id, STRING NAME, double salary)
  42.         {
  43.             Id = id;
  44.             NAME = NAME;
  45.             Salary = salary;
  46.         }
  47.  
  48.         public Doctor()
  49.         {
  50.             Id = 2018;
  51.             NAME = "Mitsos";
  52.         }
  53.  
  54.         public Doctor(INT a, INT b ,INT c, STRING d)
  55.         {
  56.             Id = a + b + c;
  57.             NAME = d;
  58.         }
  59.  
  60.         public void VIEW()
  61.         {
  62.             Console.ForegroundColor = ConsoleColor.Blue;
  63.             Console.WriteLine("Id = " + Id);
  64.             Console.ForegroundColor = ConsoleColor.Yellow;
  65.             Console.WriteLine("Name = " + NAME);
  66.             Console.ForegroundColor = ConsoleColor.Red;
  67.             Console.WriteLine("Salary = " + Salary);
  68.             Console.ForegroundColor = ConsoleColor.White;
  69.             Console.WriteLine("==============================");
  70.             Console.WriteLine();
  71.         }
  72.  
  73.         public void IncreaseSalary(double percentage)  //
  74.         {
  75.             Salary = Salary + Salary * percentage / 100;
  76.         }
  77.  
  78.         public void DecreaseSalary(double percentage)  //
  79.         {
  80.             Salary = Salary - Salary * percentage / 100;
  81.         }
  82.  
  83.  
  84.  
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement