Looking for trustworthy answers? Westonci.ca is the ultimate Q&A platform where experts share their knowledge on various topics. Join our platform to connect with experts ready to provide accurate answers to your questions in various fields. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.
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);
Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Keep exploring Westonci.ca for more insightful answers to your questions. We're here to help.