public Pay(double rateOfPay) { var insuranceRepo = new InsuranceMultipliersRepository(); this.RateOfPay = rateOfPay; this._HEALTH_INS = insuranceRepo.GetHealthMultiplier(rateOfPay); }
public Pay() { // This is a parameterless constructor. C# compiler actually generates this for you behind the scenes and sets every value to the default for its type. We're basically saying "use this instead of default one when creating an object" and providing additional instructions. In our case, the instruction would be retrieving the multiplier from the repository and storing it within the Pay class property. var insuranceRepo = new InsuranceMultipliersRepository(); this.HEALTH_INS = insuranceRepo.GetHealthMultiplier(RateOfPay); }
public Pay(Worker workerWithPay, double hoursSpent, double payRate) { var insuranceRepo = new InsuranceMultipliersRepository(); this.WorkerName = workerWithPay.WorkerName; this.HoursWorked = hoursSpent; this.RateOfPay = payRate; this._HEALTH_INS = insuranceRepo.GetHealthMultiplier(rateOfPay); }