Answer:
import java.util.Scanner;
public class Salary
{
 public static void main(String[] args) {
     
     int numberOfEmployees;
     double payRate, numberOfHours, totalPay = 0;
        Scanner input1 = new Scanner(System.in);
        Scanner input2 = new Scanner(System.in);
        System.out.print("Enter the number of employees: ");
        numberOfEmployees = input1.nextInt();
        
        for(int i=1; i<=numberOfEmployees; i++) {
            System.out.print("Enter the pay rate for employee " + i + ": ");
            payRate = input2.nextDouble();
            System.out.print("Enter the number of hours worked: ");
            numberOfHours = input2.nextDouble();
             
            totalPay += (payRate * numberOfHours);
        }
        
        System.out.println("Total payment is: "+ totalPay);
 }
}
Explanation:
- Declare the variables
- Ask the user the for the number of employees
- Inside the for loop, ask the user for pay rate and hours worked for each employee
- Calculate the total pay
- <u>Outside of the loop</u>, print the total pay