IDNLearn.com is your trusted platform for finding reliable answers. Our platform offers reliable and detailed answers, ensuring you have the information you need.
Sagot :
Answer:
In Java:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int regularhour,overtimehour;
float regularpay,overtimepay;
Scanner input = new Scanner(System.in);
System.out.print("Regular Hour: ");
regularhour = input.nextInt();
System.out.print("Overtime Hour: ");
overtimehour = input.nextInt();
System.out.print("Regular Pay: ");
regularpay = input.nextFloat();
System.out.print("Overtime Pay: ");
overtimepay = input.nextFloat();
float regulargross = regularhour * regularpay;
float overtimegross = overtimehour * overtimepay;
float totalgross = regulargross + overtimegross;
System.out.println("Regular Gross Pay: "+regulargross);
System.out.println("Overtime Gross Pay: "+overtimegross);
System.out.println("Total Gross Pay: "+totalgross);
}
}
Explanation:
This line declares regularhour and overtimehour as integer
int regularhour,overtimehour;
This line declares regularpay and overtimepay as float
float regularpay,overtimepay;
Scanner input = new Scanner(System.in);
This prompts the user for regular hour
System.out.print("Regular Hour: ");
This gets the regular hour
regularhour = input.nextInt();
This prompts the user for overtime hour
System.out.print("Overtime Hour: ");
This gets the overtime hour
overtimehour = input.nextInt();
This prompts the user for regular pay
System.out.print("Regular Pay: ");
This gets the regular pay
regularpay = input.nextFloat();
This prompts the user for overtime pay
System.out.print("Overtime Pay: ");
This gets the overtime pay
overtimepay = input.nextFloat();
This calculates the regular gross pay
float regulargross = regularhour * regularpay;
This calculates the overtime gross pay
float overtimegross = overtimehour * overtimepay;
This calculates the total gross pay
float totalgross = regulargross + overtimegross;
This prints the regular gross pay
System.out.println("Regular Gross Pay: "+regulargross);
This prints the overtime gross pay
System.out.println("Overtime Gross Pay: "+overtimegross);
This prints the total gross pay
System.out.println("Total Gross Pay: "+totalgross);
Thank you for using this platform to share and learn. Don't hesitate to keep asking and answering. We value every contribution you make. Your questions are important to us at IDNLearn.com. Thanks for stopping by, and come back for more reliable solutions.