Your design specifications must meet the following Requirements: 1. Arrays 2. Methods with parameters 3. Input or
Question:
Your design specifications must meet the following
Requirements:
1. Arrays
2. Methods with parameters
3. Input or output files
4. GUI or menu
I don't really know where to start.... I'm in an Intro Java Programming class so nothing fancy. I've run this example through IntelliJ, it did not work.
public class MyPay2
{
public static void main (String[] args)
throws FileNotFoundException{
Scanner inFile = new Scanner (new FileReader("employee.txt"));
PrintWriter outFile = new PrintWriter("outpay.txt");
String firstName;
String lastName;
double hoursWorked;
double payRate;
double wages;
double taxAmount;
double netAmount;
firstName = inFile.next();
lastName = inFile.next();
hoursWorked = inFile.nextDouble();
payRate = inFile.nextDouble();
wages = hoursWorked * payRate;
taxAmount = wages * .05;
netAmount = wages - taxAmount;
System.out.println("Paycheck for " + firstName + lastName + ". Hours worked = " + hoursWorked + " at rate of $" + payRate + ". Gross Amount = " + wages + " Tax Amount = " + taxAmount + " Total Pay = " + netAmount);
outFile.println("Paycheck for " + firstName + lastName + ". Hours worked = " + hoursWorked + " at rate of $" + payRate + ". Gross Amount = " + wages + " Tax Amount = " + taxAmount + " Total Pay = " + netAmount);
inFile.close();
outFile.close();
}
employee.txt
John Doe 40.00 12.00
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill