java - Getting output of 2 numbers after the decimal point -
new java, trying output of variables grosspayconv, taxesconv , netpayconv have output of xx.xx(having 2 places after decimal). believe casting wrong or something. keep getting numbers no values after decimal. thanks, sorry basic question, can't seem it.
p.s = if curious variable names... conv - meaning conversion
system.out.println("hours worked: "); double hours = input2.nextdouble(); system.out.println("hourly pay rate: "); double payhours = input3.nextdouble(); double grosspay = payhours*hours; double grosspayconv = (int)(grosspay*100)/100; double taxes = grosspay*tx; double taxesconv = (int)(taxes * 100) / 100; double netpay = grosspay-taxes; double netpayconv = (int)(netpay*100)/100;
why casting output int.update below :
double grosspayconv = (grosspay*100)/100;
Comments
Post a Comment