Guest User

Untitled

a guest
Jan 22nd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace CIS247A_Week_6_Lab
  7. {
  8. class Benefit
  9. {
  10. string healthInsurance = "not given";
  11. double lifeInsurance = 0;
  12. int vacation = 0;
  13.  
  14.  
  15.  
  16. public Benefit()
  17. {}
  18.  
  19. public Benefit(string health, double life, int vac)
  20. {
  21. healthInsurance = health;
  22. lifeInsurance = life;
  23. vacation = vac;
  24.  
  25.  
  26. }
  27.  
  28. public string HealthInsurance
  29. {
  30. get
  31. {
  32. return healthInsurance;
  33. }
  34. set
  35. {
  36. healthInsurance = value;
  37. }
  38. }
  39.  
  40. public double LifeInsurance
  41. {
  42. get
  43. {
  44. return lifeInsurance;
  45. }
  46. set
  47. {
  48. lifeInsurance = (value < 0) ? lifeInsurance : value;
  49. }
  50. }
  51.  
  52. public int Vacation
  53. {
  54. get
  55. {
  56. return vacation;
  57. }
  58. set
  59. {
  60. vacation = (value < 0) ? vacation : value;
  61. }
  62.  
  63. }
  64. public override string ToString()
  65. {
  66. string output = "";
  67. output += "\nHealth Insurance: " + healthInsurance;
  68. output += "\nLife Insurance\t: " + lifeInsurance.ToString("C2");
  69. output += "\nVacation\t: " + Vacation;
  70.  
  71. return output;
  72. }
  73. }
  74. }
Add Comment
Please, Sign In to add comment