S
Simfonika Island
Hi
My program is not calculating the wages correctly. Can somebody please
tell me why???
/*
* PayCheck Program
* This program computes an employee's wages for the week
*/
import java.util.Scanner;
import static java.lang.System.in;
import static java.lang.System.out;
class mainPayCheckProg
{
public static void main(String args[])
{
// create an instance of the class or object
payCheckMethods aWage = new payCheckMethods();
Scanner prompt_user = new Scanner(in);
double payRate;
double hours;
double wages;
int empNum;
double max_hours = 40.0;
double overtime = 1.5;
out.print("Enter Employee Number: ");
empNum = prompt_user.nextInt();
out.print("Enter Pay Rate: ");
payRate = prompt_user.nextDouble();
out.print("Enter Hours Worked: ");
hours = prompt_user.nextDouble();
if (hours > max_hours)
{
wages = (max_hours * payRate) + (hours - max_hours) * payRate *
overtime;
}
else
{
wages = max_hours * payRate;
}
out.print("Employee Number: ");
out.println(empNum);
out.print("Pay rate: ");
out.println(payRate);
out.print("Hours worked: ");
out.println(hours);
out.print("Wages: ");
out.println(wages);
}
}
My program is not calculating the wages correctly. Can somebody please
tell me why???
/*
* PayCheck Program
* This program computes an employee's wages for the week
*/
import java.util.Scanner;
import static java.lang.System.in;
import static java.lang.System.out;
class mainPayCheckProg
{
public static void main(String args[])
{
// create an instance of the class or object
payCheckMethods aWage = new payCheckMethods();
Scanner prompt_user = new Scanner(in);
double payRate;
double hours;
double wages;
int empNum;
double max_hours = 40.0;
double overtime = 1.5;
out.print("Enter Employee Number: ");
empNum = prompt_user.nextInt();
out.print("Enter Pay Rate: ");
payRate = prompt_user.nextDouble();
out.print("Enter Hours Worked: ");
hours = prompt_user.nextDouble();
if (hours > max_hours)
{
wages = (max_hours * payRate) + (hours - max_hours) * payRate *
overtime;
}
else
{
wages = max_hours * payRate;
}
out.print("Employee Number: ");
out.println(empNum);
out.print("Pay rate: ");
out.println(payRate);
out.print("Hours worked: ");
out.println(hours);
out.print("Wages: ");
out.println(wages);
}
}