I am taking my first Java programming class and this is my current assignment:

Design a Java program using an FILE concept. This involves writing 2 java programs. In the first program you will create a data file called "data.txt". In this file input Employee ID, Hours Worked, and Rate of Pay. Input 15 such Employee's information.

Then write a second program to access this file and read this data. Write a method to calculate the Federal tax, and another method to calculate State Tax. Call a third method to compute the take home pay and output the amount as shown below. This process should be repeated for all 15 employees.

Federal tax is 15% and State tax is 6.5% and it is computed after deducting federal tax.

I have written both programs and they work. However, my professor said I violated structured programming because I called methods within another method. I am trying to figure out how to call all my methods from the main method and still get the desired output. I am now trying to rewrite the program to read the data file and produce the desired output but I am having a hard time figuring out how to return the required values to the main method. If someone could help me get started, I would appreciate it. Here is the program that I currently have. Thank you.

// This program reads the data.txt file and outputs data

import java.io.*;
import java.util.*;
import java.text.DecimalFormat;

public class assignment5ReadFile
{
//========Main Method=============

public static void main(String args[]) throws IOException
{
FileReading(); //Method Call
} // End Main Method

//========FileReading Method=======

public static void FileReading() throws IOException
{
//Establish relationship between files
Scanner fileReader = new Scanner(new File("data.txt"));

int empID;
String firstName;
String lastName;
int hrsWrk;
double payRate;
DecimalFormat money = new DecimalFormat("$0.00");

System.out.println("****************************** ******************************");
System.out.println(" Employee Record ");
System.out.println("****************************** ******************************");

//Read 1st Record

empID = fileReader.nextInt();
firstName = fileReader.next();
lastName = fileReader.next();
hrsWrk = fileReader.nextInt();
payRate = fileReader.nextDouble();

//Check for end of file

while (empID != 0)
{
if (empID != 0)
{
System.out.println("Employee ID: " + empID);
System.out.println("Employee Name: " + firstName + " " + lastName);
System.out.println("Pay Rate: " + money.format(payRate) + " Hours Worked: " + hrsWrk);
calcHrsPay(hrsWrk, payRate);
System.out.println("****************************** ******************************");
} // End IF Statement

//Read Next Record

empID = fileReader.nextInt();
firstName = fileReader.next();
lastName = fileReader.next();
hrsWrk = fileReader.nextInt();
payRate = fileReader.nextDouble();
} // End WHILE Loop

//End File and Close Reader
System.out.println();
System.out.println("*************************END OF FILE************************");

fileReader.close();
}// End of FileReading Method

//===============calcHrsPay Method========================

public static void calcHrsPay(int hours, double pay)
{
int regular;
int overtime;
double grossPay;
DecimalFormat money = new DecimalFormat("$0.00");

if (hours < 40)
{
regular = hours;
overtime = 0;
grossPay = hours * pay;
System.out.println("Regular Hrs: " + regular + " Overtime Hrs: " + overtime);
System.out.println("Gross Pay: " + money.format(grossPay));
fedTax(grossPay); //Call federal tax method
}
else
{
regular = 40;
overtime = hours - 40;
grossPay = (regular * pay) + overtime *(pay * 1.5);
System.out.println("Regular Hrs: " + regular + " Overtime Hrs: " + overtime);
System.out.println("Gross Pay: " + money.format(grossPay));
fedTax(grossPay); //Call federal tax method
}
}// End calcHrsPay Method

//===================fedTax Method=========================

public static void fedTax(double pay)
{
double fedTaxRate = .15;
double fedTax;
double payAfterFed;
DecimalFormat money = new DecimalFormat("$0.00");

fedTax = pay * fedTaxRate;
payAfterFed = pay - fedTax;

System.out.println("Federal Tax: " + money.format(fedTax));

calcStateTax(payAfterFed, fedTax, pay); // call state tax method
} // End fedTax Method

//===========calcStateTax Method==========================

public static void calcStateTax(double payNetFed, double ft, double p)
{
double stateTaxRate = .065;
double stateTax;
DecimalFormat money = new DecimalFormat("$0.00");

stateTax = payNetFed * stateTaxRate;

System.out.println("State Tax: " + money.format(stateTax));
calcNetPay(ft, stateTax, p);
} // End calcStateTax Method

//==============calcNetPayMethod==================== =======

public static void calcNetPay(double f, double s, double p)
{
double netPay;
DecimalFormat money = new DecimalFormat("$0.00");

netPay = p - f - s;

System.out.println("Net Pay: " + money.format(netPay));
}// End calcNetPay Method

}// End of Class