package employeesalary;
import java.util.Scanner;
public class EmployeeSalary {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of hours worked: ");
int hoursWorked = input.nextInt();
double salary = 0;
if (hoursWorked <= 40) {
salary = hoursWorked * 50;
} else {
salary = 40 * 50 + (hoursWorked - 40) * 30;
}
System.out.println("The salary is: " + salary);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter