Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6 //Compiler Directive Section 7 import java.util.Scanner; 8 //*****************

ID: 3543375 • Letter: 6

Question

6 //Compiler Directive Section
7 import java.util.Scanner;
8 //***************************************************************
9 public class Salary
10 {
11    public static void main (String arg[])
12    {
13    double hours;           //Hourly rate
14    double payRate;         //Pay rate
15    double reg_rate;        //Regular hours
16    double overTimeHours;   //Overtime hours
17    double overTime;        //Overtime
18    
19    Scanner keyboard = new Scanner(System.in);
20    
21    //declaration section
22    
23    System.out.print("How many hours did you work this week? ");
24    hours = keyboard.nextDouble();
25    System.out.print("What is your pay rate? ");
26    payRate = keyboard.nextDouble();
27
28    if (hours > 40)
29    {
30    overTimeHours = (hours - 40);
31    
32    overTime = overTimeHours * payRate * 1.5;
33    }
34    else
35    {
36    (hours * payRate);
37    }
38    }//end main
39       
40 } //end class

Explanation / Answer

I THINK THIS IS WHA T YOU WANTED HERE:


//Compiler Directive Section
import java.util.Scanner;
//***************************************************************
public class Game
{
public static void main (String arg[])
{
double hours; //Hourly rate
double payRate; //Pay rate
double reg_rate; //Regular hours
double overTimeHours; //Overtime hours
double overTime; //Overtime

Scanner keyboard = new Scanner(System.in);

//declaration section

System.out.print("How many hours did you work this week? ");
hours = keyboard.nextDouble();
System.out.print("What is your pay rate? ");
payRate = keyboard.nextDouble();

if (hours > 40)
{
overTimeHours = (hours - 40);
                            reg_rate=(40 * payRate);
overTime = overTimeHours * payRate * 1.5+reg_rate;
System.out.println("Money paid this week "+overTime);
}
else
{
           reg_rate=(hours * payRate);
System.out.println("Money paid this week "+reg_rate);
}
        
}//end main

} //end class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote