In the following program the output is being written all on one line. I added line separators "/n". Why are they not working?
import javax.swing.*; import java.io.*; public class Monthly_pay { static final double FED_TAX = .15; static final double STATE_TAX = .035; static final double SS_TAX = .0575; static final double MEDICARE = .0275; static final double PENSION = .05; static final double HEALTH_INS = 75.00; public static void main(String[] args) { String name, grossPay; double netPay, dGrossPay, fedTax, stateTax, ssTax, medicare, pension, healthIns; JOptionPane jop = new JOptionPane(); name = jop.showInputDialog("Please enter the employee name: "); grossPay = jop.showInputDialog("Please enter the employee's gross pay: "); dGrossPay = Double.parseDouble(grossPay); fedTax = dGrossPay * FED_TAX; stateTax = dGrossPay * STATE_TAX; ssTax = dGrossPay * SS_TAX; medicare = dGrossPay * MEDICARE; pension = dGrossPay * PENSION; netPay = dGrossPay - (fedTax + stateTax + ssTax + medicare + pension + HEALTH_INS); jop.showMessageDialog(null, "Here is the break down of" + " " + name + "'s" + " " + "monthly pay. " + "/n" + "Gross pay: $" + String.format("%.2f", dGrossPay) + "/n" + "Federal Tax: $" + String.format("%.2f", fedTax) + "/n" + "State Tax: $" + String.format("%.2f", stateTax) + "/n" + "Social Security Tax: $" + String.format("%.2f", ssTax) + "/n" + "Medicare / Medicade: $" + String.format("%.2f", medicare) + "/n" + "Pension Plan: $" + String.format("%.2f", pension) + "/n" + "Health Insurance: $" + String.format("%.2f", HEALTH_INS) + "/n" + "Net Pay: $" + String.format("%.2f", netPay)); System.exit(0); } }
Thanks in advance!