## Gross Pay/Net Pay Calculator

Hello, I'm fairly new to programming in java, and over the course of the months in learning and doing projects on it, have gotten used to a pattern of what every newbie programmer goes through: being overwhelmed doing a project I have no idea on what's it's about, over-exhausting resources in looking for the answer in a commonly overlooked mistake, thinking everything is going right while actually writing code, then compiling the code and hitting a roadblock in one place where everything else is fine. That's how it feels again with this program, that I'm struggling to complete for class.

Basically, I'm trying to make a gross pay calculator program that determines how much an employee is paid based on how many hours they work and what they're being paid already. Then it takes the gross pay and uses that to calculate the tax pay. The federal, state, local, and fica taxes all have set values and the gross pay is multiplied by each of them to get tax pay values for each. Then all of the tax pay earnings are displayed to the first 2 decimal points. Each calculation is done in its own method and the result is returned for another method to take in.

My main concern is using different methods and another class to put the separate tax variables in and getting the values to other classes. We're not allowed to use arrays, or getter and setters for methods, and I don't think the professor whats us to use one method for each calculation either. Making a new instance in a class to use its methods may not be allowed either. The tax values with set values all are suggested to be in its own class so their values aren't changed. I know that you can't return no more than one value per method, but I need each calculated tax pay value after being multiplied by the gross pay to be returned to the display method, and it doesn't seem efficient to send each variable to the display method one one-by-one.

Here's my code so far:

Code:
```import java.util.Scanner;
/**
* Write a description of class GrossToNet here.
*
* @version (a version number or a date)
*/
public class GrossToNet
{
public static void main()
{
Scanner scan = new Scanner(System.in);
while (true) {
System.out.print("Please enter number of hours worked. 0 to quit: ");
double hoursWorked = scan.nextDouble();

if (hoursWorked == 0)  {
break;
}

System.out.print("Please enter the payrate. 0 to quit: ");
double payRate = scan.nextDouble();

if (payRate == 0) {
break;
}

double grossPay = payCalc(hoursWorked, payRate); //send 'hoursworked' and 'payrate' variables to paycalc method

displayTaxes(grossPay); //sends grossPay to the display method for it to be displayed there in text
}
System.out.println("Gross Pay Calculator Program Ended");
}

public static double payCalc(double hoursIn, double payIn)
{
double gPay = 0;

if (hoursIn <= 40)
{
gPay = (payIn * hoursIn);
}

else
{
gPay = (40 * payIn) + ((hoursIn - 40) * (payIn * 1.5));
}

return gPay;
}

public static void displayTaxes(double grossIn)

{
System.out.printf("Your gross pay is \$%.2f\n", grossIn);
System.out.print("\n");

}
}

class TaxVariables //the tax varaibles are being put in another class in order to be referenced (for the usage of other methods)
//the values shouldn't change when the objects are being referenced to in each method
{

private static final double FEDERAL = .16, STATE = .06, LOCAL = 3.5, FICA = 4.75;

public static void taxCalc (double grossTaxPay)
{
double fedTax = (grossTaxPay * FEDERAL);
double stateTax = (grossTaxPay * STATE);
double locTax = (grossTaxPay * LOCAL);
double ficaTax = (grossTaxPay * FICA);
} //needs to return a value- bring in grossPay from payCalc method into taxCalc method in TaxVariables class

}```
Here's an excerpt of the directions for the assignment :

Purpose:

To demonstrate your ability to design and code a project with many constants, variables and calculations with the major work being done in methods. Also to show that you understand how to pass values and references to methods so that a method may "return" multiple results.

And a hint the instructor gave:

Hint: declare a class that contains all the pay variables so that they may be passed to the various methods by reference.

I first need to send grossPay to the TaxVaraiables class in the taxCalc method, and the calculated values of the taxes from the TaxVariables class to the GrossToNet class in the display method in order for this project to work.

That's whats making me stuck here, can anyone help?