Fernando Z. answered 05/17/19
Patient Programming Tutor Specializing in C, Java, and Python
Depending on the language you are using will determine how to code this. Assuming this is in java you would do it like this.
double gross_pay =Math.Round( (hours * pay_rate) * 100.0) / 100.0;
double tax_rate = 18;
double net_pay = gross_pay - (gross_pay * (tax_rate/100.0));
It gets a little funky to round off to two decimals but that is one way to do it.
Instead normally you just round off during the display of the values when you convert the value to a string for rendering.