import java.util.Scanner;//importing Scanner
public class SalaryCalculator {
public static void main(String[] args)
{
System.out.println("Your name here \n");
Scanner input = new Scanner(System.in);
double pay, rate, hours;//using double to hold floating points to keep the calculator accurate to
the decimal
System.out.println("Employee: Pick Employee Name");//showing employee
System.out.print("Enter Employee’s number of hours worked: " );//prompt
hours = input.nextDouble();//get input and store in hours variable
System.out.print("Enter Employee’s Hourly Rate: ");//prompt
rate = input.nextDouble();//get input and store as rate variable
if (hours > 40.0)//algorithm for overtime
pay = 40.0 * rate +
1.5 * rate * (hours - 40.0);
else//algorithm if no overtime
pay = hours * rate;
System.out.printf("Employee receives $%.2f %n", pay);//$ + a float with two
decimals + new line
System.out.println("Employee: Enter Employee’s name");
public class SalaryCalculator {
public static void main(String[] args)
{
System.out.println("Your name here \n");
Scanner input = new Scanner(System.in);
double pay, rate, hours;//using double to hold floating points to keep the calculator accurate to
the decimal
System.out.println("Employee: Pick Employee Name");//showing employee
System.out.print("Enter Employee’s number of hours worked: " );//prompt
hours = input.nextDouble();//get input and store in hours variable
System.out.print("Enter Employee’s Hourly Rate: ");//prompt
rate = input.nextDouble();//get input and store as rate variable
if (hours > 40.0)//algorithm for overtime
pay = 40.0 * rate +
1.5 * rate * (hours - 40.0);
else//algorithm if no overtime
pay = hours * rate;
System.out.printf("Employee receives $%.2f %n", pay);//$ + a float with two
decimals + new line
System.out.println("Employee: Enter Employee’s name");