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;
- namespace CIS247A_Week_6_Lab
- {
- class Benefit
- {
- string healthInsurance = "not given";
- double lifeInsurance = 0;
- int vacation = 0;
- public Benefit()
- {}
- public Benefit(string health, double life, int vac)
- {
- healthInsurance = health;
- lifeInsurance = life;
- vacation = vac;
- }
- public string HealthInsurance
- {
- get
- {
- return healthInsurance;
- }
- set
- {
- healthInsurance = value;
- }
- }
- public double LifeInsurance
- {
- get
- {
- return lifeInsurance;
- }
- set
- {
- lifeInsurance = (value < 0) ? lifeInsurance : value;
- }
- }
- public int Vacation
- {
- get
- {
- return vacation;
- }
- set
- {
- vacation = (value < 0) ? vacation : value;
- }
- }
- public override string ToString()
- {
- string output = "";
- output += "\nHealth Insurance: " + healthInsurance;
- output += "\nLife Insurance\t: " + lifeInsurance.ToString("C2");
- output += "\nVacation\t: " + Vacation;
- return output;
- }
- }
- }
Add Comment
Please, Sign In to add comment