I'm attempting to add interactive input to a program. I've been working on it for hours and can't figure it out. Here is the code -
// This program calculates an employee's take home pay.
public class Payrolls
import javax.swing.JOptionPane;
{
public static void main(String args[])
{
String salaryString;
double salary;
double stateTax;
double federalTax;
String numDependentsString;
double numDependents;
double dependentDeduction;
double totalWithholding;
double takeHomePay;
salaryString = JOptionPane.showInputDialog ("Enter Salary Here: ");
salary = double.parseDouble (salaryString);
numDependentsString = JOptionPane.showInputDialog ("Enter Number of Dependents: ");
numDependents = double.parseDouble (numDependentsString);
// Calculate state tax here.
stateTax = salary * .06;
System.out.println("State Tax: $" + stateTax);
// Calculate federal tax here.
federalTax = salary * .25;
System.out.println("Federal Tax: $" + federalTax);
// Calculate dependant deduction here.
dependentDeduction = (salary * .02) * numDependents;
System.out.println("Dependents: $" + dependentDeduction);
// Calculate total withholding here.
totalWithholding = stateTax + federalTax;
// Calculate take home pay here.
takeHomePay = salary - totalWithholding + dependentDeduction;
System.out.println("Salary: $" + salary);
System.out.println("Take Home Pay: $" + takeHomePay);
System.exit(0);
}
}
I have 9 errors -
Payrolls.java:19: error: class expected
salary = double.parseDouble (salaryString);
^
Payrolls.java:19: error: ';' expected
salary = double.parseDouble (salaryString);
^
Payrolls.java:19: error: not a statement
salary = double.parseDouble (salaryString);
^
Payrolls.java:19: error: ';' expected
salary = double.parseDouble (salaryString);
^
Payrolls.java:21: error: class expected
numDependents = double.parseDouble (numDependentsString);
^
Payrolls.java:21: error: ';' expected
numDependents = double.parseDouble (numDependentsString);
^
Payrolls.java:21: error: not a statement
numDependents = double.parseDouble (numDependentsString);
^
Payrolls.java:21: error: ';' expected
numDependents = double.parseDouble (numDependentsString);