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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Based on the given requirements heres an updated version of the code that incorporates arrays methods with parameters and inputoutput files import jav...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started