winforms - C# Calculate Employee Salary in a Class or via button click? -


i'm developing payroll software major project. tax information (jamaican income tax) should calculated, added , subtracted base pay secretary enter via textbox.

the tax percentage , calculations each type of tax contained in checkboxes. result of calculations of taxes incorrect. if base pay less threshold tax (22800) income tax becomes negative value. if 1 checkbox checked before other result checkbox becomes incorrect.

i know if easier perform calculations employee salary in class or within button click event.

thanks in advance help.

first of all, mixing few thing sup here.

checkboxes should never used data storage - ui elements , job display results, or take inputs.

ideally, should have class represents object - in case payroll guess. payroll class should know it's own tax calculations, amount of salary , related payroll.

if have checkboxes correspond tax amounts deducted, use sort of resolver class return tax amount based on state of checkboxes selected. checkbox values should correspond enum.

in mouse click event should have couple lines, this:

// tax here taxamount variable, then...  var currentpayroll = //somehow payroll ever storing it. currentpayroll.calculatetax(taxamount); 

you need read more solid principles.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -