Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

java question You have defined the following java variables, write a single DOS

ID: 3810062 • Letter: J

Question

java question

You have defined the following java variables, write a single DOS O/P statement to display the values of these variables in this format: (Reference to book p101 formatted O/P sample in the bottom or reference to CH02 PPT slide# 160) Defined variables: double income;//income amount double taxRate = 0.10;//income tax rate in percentage double taxAmount;//income amount equals income amount times tax rate double netPayment;//subtract tax amount to get net payment (income) O/P format: Income amount $xxxxxxx. Tax rate = xx xx%, Tax amount = $xxx xx, Net payment = $xxx.xx Assumed that the O/P variable values are calculated here:

Explanation / Answer

Single statement to print the above lines would be

System.out.printf("Income amount = $%.2f, Tax rate = %.2f%% Tax amount = $%.2f, Net payment = $%.2f ",income, taxRate, taxAmount, netPayment);