this may be simple or fairly difficult...I have no idea either way. Here's my code:
package looping;
import java.util.Scanner;
public class PayrollMethods2 {
public static void main(String[] args) {
int hours = 0;
double wr = 0;
double pay;
getData(hours, wr);
pay = calculatePay(hours, wr);
System.out.println(pay);
// TODO Auto-generated method stub
}
public static void getData(Integer hours, Double wr)
{
Scanner kb = new Scanner(System.in);
System.out.print("Please enter your wage rate ");
wr = kb.nextDouble();
System.out.print("Please enter your hours work ");
hours = kb.nextInt();
}
public static double calculatePay(int hours, double wr)
{
if(hours <= 40)
return hours * wr;
else
return (40 * wr) + ((hours - 40) * (1.5* wr));
}
}
I want to return the method "getData()" so that when I enter hours and wr on the keyboard, it will return the total. However, it return a total of 0.0 no matter what I press. I know it has something to do with me assigning a value of 0 to the variables and also that the method is "void". But I have no idea how to modify the getData() method so that it returns the proper values.