Troubles with a Java Program

Icee WeinerIcee Weiner Regular
edited October 2011 in Tech & Games
Ok so here's the deal. I need to write a program that will calculate the monthly paycheck for an employee. I have it all written out and what not. The only thing I'm having trouble with is aligning the dollar sign with the total amount for each tax deduction. Here's what I have so far:
//Output
System.out.println(employeeName);
System.out.printf("==============================\n");
System.out.printf("Federal Income Tax: %11.2f\n", federalIncomeTax);
System.out.printf("State Tax: $%19.2f\n", stateTax);
System.out.printf("Social Security Tax: $%9.2f\n", socialSecurityTax);
System.out.printf("Medicare/Medicaid Tax: $%7.2f\n", medicareMedicaidTax);
System.out.printf("Pension Plan: $%16.2f\n", pensionPlan);
System.out.printf("Health Insurance: $%12.2f\n", healthInsurance);
System.out.printf("===============================\n");
System.out.printf("Net Pay: $%21.2f\n", netPay);
So what do I need to add so the dollar sign will align along with the number?

Comments

Sign In or Register to comment.