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

Here is my code, I have some errors I just need worked out, Please help! import

ID: 3659669 • Letter: H

Question

Here is my code, I have some errors I just need worked out, Please help!

import java.util.*;
import javax.swing.*;
import javax.swing.JOptionPane;

public class Payroll
{
public static void main(String[] args)
{

int choice;
choice = 0;
double retirement;
double insurance;
double totalPay;
insurance = 0;
double rate;
rate = 0;
int option;
double hoursWorked;
double regularPay;
double overtimePay;
double netPay;
int skillLevel;
final int FULL_WEEK = 40;
final double OT_RATE = 1.5;
Scanner keyboard = new Scanner(System.in);

System.out.print("What is your skill level? Enter 1, 2, or 3: ");
skillLevel = keyboard.nextInt();
if(skillLevel == 1)
rate = 17.00;
else
if(skillLevel == 2)
rate = 20.00;
else
if(skillLevel == 3)
rate = 22.00;
else
System.out.println("Invalid skill level.");

System.out.print("How many hours did you work this week?");
hoursWorked = keyboard.nextDouble();
if(hoursWorked > FULL_WEEK)
{
regularPay = FULL_WEEK * rate;
overtimePay = (hoursWorked - FULL_WEEK) * OT_RATE * rate;
}
else
{

regularPay = hoursWorked * rate;
overtimePay = 0.0;
}


int n = JOptionPane.showConfirmDialog(null,"You want medical insurance?",
JOptionPane.YES_NO_OPTION);
//use value of n for other loops as activator
if(true){
JOptionPane.showMessageDialog(null, "1");
}
else {
JOptionPane.showMessageDialog(null, "0");
}
int m = JOptionPane.showConfirmDialog(null,"You want dental insurance?",
JOptionPane.YES_NO_OPTION);

if(true){
JOptionPane.showMessageDialog(null, "1");
}
else {
JOptionPane.showMessageDialog(null, "0");
}
int b = JOptionPane.showConfirmDialog(null,"You want long term disability insurance?",
JOptionPane.YES_NO_OPTION);

if(true){
JOptionPane.showMessageDialog(null, "1");
}
else {
JOptionPane.showMessageDialog(null, "0");
}

int skill = JOptionPane.showConfirmDialog(null,"your skill level?",
JOptionPane.YES_NO_OPTION);
if(true){
JOptionPane.showMessageDialog(null, "1");
}
else {
JOptionPane.showMessageDialog(null, "0");
}
do{
int i =0;i<m;m0b}
}while(b=false)
else

if(skillLevel == 1)
insurance = 0;
if(skillLevel == 3)
System.out.println("Would you like to participate in the retirement plan? Enter 1 for yes or 0 for no: ");
choice = keyboard.nextInt();
if(choice == 1)
retirement = 0.03;
else
retirement = 0;
totalPay = regularPay + overtimePay;
netPay = totalPay - insurance;
System.out.println("Regular pay is " +
regularPay + " Overtime pay is " + overtimePay + " Hours worked: " + hoursWorked +
" Your hourly rate is: " + rate + " Total gross pay is: " + (regularPay + overtimePay) +
" Your total deductions are: " + insurance + " Your net pay is: " + netPay);

}

}

Explanation / Answer

/*Error Free code*/

import java.util.*;
import javax.swing.*;
import javax.swing.JOptionPane;

public class Payroll
{
    public static void main(String[] args)
    {

        int choice;
        choice = 0;
        double retirement;
        double insurance;
        double totalPay;
        insurance = 0;
        double rate;
        rate = 0;
        int option;
        double hoursWorked;
        double regularPay;
        double overtimePay;
        double netPay;
        int skillLevel;
        final int FULL_WEEK = 40;
        final double OT_RATE = 1.5;
        Scanner keyboard = new Scanner(System.in);

        System.out.print("What is your skill level? Enter 1, 2, or 3: ");
        skillLevel = keyboard.nextInt();
        if(skillLevel == 1)
            rate = 17.00;
        else
            if(skillLevel == 2)
                rate = 20.00;
            else
                if(skillLevel == 3)
                    rate = 22.00;
                else
                    System.out.println("Invalid skill level.");

        System.out.print("How many hours did you work this week?");
        hoursWorked = keyboard.nextDouble();
        if(hoursWorked > FULL_WEEK)
        {
            regularPay = FULL_WEEK * rate;
            overtimePay = (hoursWorked - FULL_WEEK) * OT_RATE * rate;
        }
        else
        {

            regularPay = hoursWorked * rate;
            overtimePay = 0.0;
        }


        int n = JOptionPane.showConfirmDialog(null,"You want medical insurance?",
                null, JOptionPane.YES_NO_OPTION);
        //use value of n for other loops as activator
        if(true){
            JOptionPane.showMessageDialog(null, "1");
        }
        else {
            JOptionPane.showMessageDialog(null, "0");
        }
        int m = JOptionPane.showConfirmDialog(null,"You want dental insurance?",
                null, JOptionPane.YES_NO_OPTION);

        if(true){
            JOptionPane.showMessageDialog(null, "1");
        }
        else {
            JOptionPane.showMessageDialog(null, "0");
        }
       
        int b = JOptionPane.showConfirmDialog(null,"You want long term disability insurance?",
                null, JOptionPane.YES_NO_OPTION);

        if(true){
            JOptionPane.showMessageDialog(null, "1");
        }
        else {
            JOptionPane.showMessageDialog(null, "0");
        }

        int skill = JOptionPane.showConfirmDialog(null,"your skill level?",
                null, JOptionPane.YES_NO_OPTION);
        if(true){
            JOptionPane.showMessageDialog(null, "1");
        }
        else {
            JOptionPane.showMessageDialog(null, "0");
        }
       
        do{
            int i =0;
            if(i<m)
                m=b;
        }while(b==0);
       
    //    else
   
            if(skillLevel == 1)
                insurance = 0;
        if(skillLevel == 3)
            System.out.println("Would you like to participate in the retirement plan? Enter 1 for yes or 0 for no: ");
        choice = keyboard.nextInt();
        if(choice == 1)
            retirement = 0.03;
        else
            retirement = 0;
        totalPay = regularPay + overtimePay;
        netPay = totalPay - insurance;
        System.out.println("Regular pay is " +
                regularPay + " Overtime pay is " + overtimePay + " Hours worked: " + hoursWorked +
                " Your hourly rate is: " + rate + " Total gross pay is: " + (regularPay + overtimePay) +
                " Your total deductions are: " + insurance + " Your net pay is: " + netPay);

}
   
}

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