# Calculate Weekly Salary and Overtime Pay in Java

The following Java program application calculates the Weekly Salary of an employee. The program determines an employee’s weekly wages. If the hours worked exceed 40, then wages include overtime payment. . I will be using the JCreator IDE in developing the program. To start in this tutorial, first open the JCreator IDE, click new and paste the following code.
`import java.util.*; public class WeeklyWages{ 	static Scanner console = new Scanner(System.in); 	public static void main(String[] args)	{ double wages, rate, hours; System.out.print("Enter the working hours:");hours = console.nextDouble();System.out.println(); System.out.print("Enter the pay rate:");rate = console.nextDouble();System.out.println();  if (hours > 40.0)	wages = 40.0 * rate +			1.5 * rate * (hours - 40.0); else	wages = hours * rate; System.out.printf("The wages are \$%.2f %n",			wages); System.out.println(); }}`
Sample run #1:
`Enter the working hours:40 Enter the pay rate:12 The wages are \$480.00`
Sample run #2:
`Enter the working hours:45 Enter the pay rate:100 The wages are \$4750.00`
The program works as follows: The statement
` System.out.print("Enter the working hours:");hours = console.nextDouble();System.out.println(); `
prompts the user to input the number of hours worked. The statement
` System.out.print("Enter the pay rate:");rate = console.nextDouble();System.out.println();`
prompts the user to enter the pay rate. The statement
` if (hours > 40.0)	wages = 40.0 * rate +			1.5 * rate * (hours - 40.0);`
checks whether the value of the variable hours is greater than 40.0 If hours are greater than 40.0, then the wages are calculated, which also includes overtime payment, the wages are calculated by the statement ` wages = hours * rate;`