Write a program that calculate and displays an employee’s weekly salary. If the hours worked are less or equal to 40, the employee is payed N$65.54 per hour, otherwise the employee receives N$80.20 for every hour worked exceeding 40.
public class Main {
 public static void main(String[] args) {
  display(24);
  display(38);
  display(44);
 }
 public void display(int hours) {
  System.out.println(calcWeeklySalary(hours));
 }
 public double calcWeeklySalary(int hours) {
  if (hours <= 40) return 65.54;
  else return 80.20;
 }
}
Comments