Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions