Westonci.ca makes finding answers easy, with a community of experts ready to provide you with the information you seek. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.
Sagot :
Answer:
import java.util.Scanner;
// Needed for the Scanner class This program calculates the user's gross pay.
public class Pay {
public static void main(String[] args) {
// Create a Scanner object to read from the keyboard.
Scanner keyboard = new Scanner(System.in);
// Identifier declarations
double hours;
// Number of hours worked
double rate;
// Hourly pay rate
double pay;
// Gross pay
// Display prompts and get input.
System.out.print("How many hours did you work? ");
hours = keyboard.nextDouble();
System.out.print("How much are you paid per hour? ");
rate = keyboard.nextDouble();
// Perform the calculations.
if (hours <= 40) {
pay = hours * rate;
}
else
{
pay = (hours - 40) - (1.5 * rate) + 40 - rate;
}
// Display results.
System.out.println("You earned $" + pay);
}
}
Explanation:
We appreciate your time. Please revisit us for more reliable answers to any questions you may have. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Thank you for visiting Westonci.ca. Stay informed by coming back for more detailed answers.