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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -