Advertisement
dsavov_02

zplata

Apr 10th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp15
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Person person = new Person();
  14. Person person1 = new Person("Pesho", "Ivanov", 30, 1000);
  15. person1.Percent();
  16. person.Percent();
  17.  
  18. }
  19. }
  20. class Person
  21. {
  22. private string firstname;
  23. private string lastname;
  24. private int age;
  25. private double zaplata;
  26.  
  27. public Person(string firstname, string lastname, int age, double zaplata)
  28. {
  29. this.firstname = firstname;
  30. this.lastname = lastname;
  31. this.age = age;
  32. this.zaplata = zaplata;
  33. }
  34. public Person()
  35. {
  36. this.firstname = "Kaloyan";
  37. this.lastname = "Stoilov";
  38. this.age = 16;
  39. this.zaplata = 900;
  40. }
  41. public string Getfirstname()
  42. {
  43. return this.firstname;
  44. }
  45. public void Setfisrtname(string firstname)
  46. {
  47. this.firstname = firstname;
  48. }
  49. public string Getlastname()
  50. {
  51. return this.lastname;
  52. }
  53. public void Setlastname(string lastname)
  54. {
  55. this.lastname = lastname;
  56. }
  57. public int Getage()
  58. {
  59. return this.age;
  60. }
  61. public void Setage(int age)
  62. {
  63. this.age = age;
  64. }
  65. public void Percent()
  66. {
  67. Console.WriteLine("{0}", zaplata);
  68. int percent = int.Parse(Console.ReadLine());
  69. if (percent > 0 && percent <= 100)
  70. {
  71.  
  72. if (age < 30)
  73. {
  74. Console.WriteLine("{0}", (zaplata * percent) / 100 / 2 + zaplata);
  75. }
  76. else
  77. {
  78. Console.WriteLine("{0}", (zaplata * percent) / 100 + zaplata);
  79. }
  80.  
  81. }
  82. }
  83.  
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement