Answered You can hire a professional tutor to get the answer.

QUESTION

INTRODUCTION : Java is the second of four languages you will be learning. Java is an object-oriented programming language used widely in business and...

the program to read user input for weeklyHours. Run the program again.

import java.util.Scanner;

public class Salary {                        

  public static void main(String [] args) {

      Scanner scnr = new Scanner(System.in);

      int hourlyWage = 0;

      int weeklyHours = 0;

      int weeklySalary = 0;

      int overtimeHours = 0;

      final int WEEKLY_LIMIT = 40;

      System.out.println("Enter hourly wage: ");

      hourlyWage = scnr.nextInt();

      // FIXME: Get user input value for weeklyHours

      weeklyHours = 40;

      if (weeklyHours <= WEEKLY_LIMIT) {

         weeklySalary = weeklyHours * hourlyWage;

      }

      else {

         overtimeHours = weeklyHours - WEEKLY_LIMIT;

         weeklySalary = (int)((hourlyWage * WEEKLY_LIMIT) +

                              (hourlyWage * overtimeHours * 1.5));

      }

      System.out.print("Weekly salary is: " + weeklySalary);        

     return;

  }

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question