Widget Company runs a small factory that makes several typesof nuts and bolts. T
ID: 3610874 • Letter: W
Question
Widget Company runs a small factory that makes several typesof nuts and bolts. They employ factory workers that are paid one ofthree hourly rates depending on skill level: a) 7.00, b)10.00, orc) 12.00. Each factory worker can work: a) 40 hours, b) 45 hours,and c) 50 hours per week. All hours over 40 are paid at doubletime. Jack Smith, the factory manager, wants you to write aninteractive Java payroll program that will calculate the gross payfor a factory worker. Hours worked and hourly pay rate are to beentered from the keyboard. Once the figures are entered for anemployee, the program prints out: 1) the hours worked, 2) thehourly pay rate, 3) the regular pay for 40 hours, and 4) theovertime pay. The class name is pay.java. Need to use switch statements and joptionpane "pop-up"boxes. This is an example of switch statements and joptionpaneboxes. //Payroll2import javax.swing.*;
public class pay.java
{
public static void main(String[]args)
{
JOptionPane.showMessageDialog(null,"What is your skill level?");
char a =response.charAt(0);
String response = JOptionPane.showInputDialog(null,"A)7.00; B)10.00; or C) 12.00");
JOptionPane.showMessageDialog(null,"How many hours do you work perweek?");
char b =response.charBt(0);
String word = JOptionPane.showInputDialog(null,"A)40 hours; B)45 hours; or C)50hours");
String word1 = JOptionPane.showInputDialog(null,"Type in your hourlyrate.");
double num1 =Double.parseDouble(response);
double num2 =Double.parseDouble(work);
double num3 =Double.parseDouble(work1);
switch (a)
{
case 'A':
case 'a':
{
hourworked * payrate = grosspay;
JOptionPane.showMessageDialog(null,
}
case 'D':
case 'd':
{
}
case 'H':
case 'h':
{
Ending1.last("Problem #13");
}
}
}
}
This above is just an example. PLEASE HELP! Widget Company runs a small factory that makes several typesof nuts and bolts. They employ factory workers that are paid one ofthree hourly rates depending on skill level: a) 7.00, b)10.00, orc) 12.00. Each factory worker can work: a) 40 hours, b) 45 hours,and c) 50 hours per week. All hours over 40 are paid at doubletime. Jack Smith, the factory manager, wants you to write aninteractive Java payroll program that will calculate the gross payfor a factory worker. Hours worked and hourly pay rate are to beentered from the keyboard. Once the figures are entered for anemployee, the program prints out: 1) the hours worked, 2) thehourly pay rate, 3) the regular pay for 40 hours, and 4) theovertime pay. The class name is pay.java. Need to use switch statements and joptionpane "pop-up"boxes. This is an example of switch statements and joptionpaneboxes. //Payroll2
import javax.swing.*;
public class pay.java
{
public static void main(String[]args)
{
JOptionPane.showMessageDialog(null,"What is your skill level?");
char a =response.charAt(0);
String response = JOptionPane.showInputDialog(null,"A)7.00; B)10.00; or C) 12.00");
JOptionPane.showMessageDialog(null,"How many hours do you work perweek?");
char b =response.charBt(0);
String word = JOptionPane.showInputDialog(null,"A)40 hours; B)45 hours; or C)50hours");
String word1 = JOptionPane.showInputDialog(null,"Type in your hourlyrate.");
double num1 =Double.parseDouble(response);
double num2 =Double.parseDouble(work);
double num3 =Double.parseDouble(work1);
switch (a)
{
case 'A':
case 'a':
{
hourworked * payrate = grosspay;
JOptionPane.showMessageDialog(null,
}
case 'D':
case 'd':
{
}
case 'H':
case 'h':
{
Ending1.last("Problem #13");
}
}
}
}
This above is just an example. PLEASE HELP! PLEASE HELP!
Explanation / Answer
please rate - thanks you want everything! import javax.swing.*; public class pay_java { public static void main(String[] args) {char a; int error=0,hours=0; double payrate=0, salary=0,overtime,regular; String output; String response = JOptionPane.showInputDialog(null, "What is yourskill level? A)7.00; B)10.00; or C) 12.00 "); a=response.charAt(0); switch (a) { case 'A': case 'a': payrate=7; break; case 'B': case 'b': payrate=10; break; case 'C': case 'c': payrate=12; break; default: JOptionPane.showMessageDialog(null, "Illegal input-Programaborting!!","Error",JOptionPane.ERROR_MESSAGE); error=1; } if(error==0) { response = JOptionPane.showInputDialog(null, "Howmany hours do you work per week? A)40 hours; B)45 hours; or C)50hours"); a= response.charAt(0); switch(a) {case 'A': case 'a': hours=40; break; case 'B': case 'b': hours=45; break; case 'C': case 'c': hours=50; break; default: JOptionPane.showMessageDialog(null, "Illegal input-Programaborting!!","Error",JOptionPane.ERROR_MESSAGE); error=1; } if(error==0) {switch(hours) {case40: regular=hours*payrate; overtime=0; break; default: regular=40*payrate; overtime=(hours-40)*payrate*2; break; } salary=regular+overtime; output="Your Salary is $"+salary; JOptionPane.showMessageDialog(null,output,"Salary",JOptionPane.INFORMATION_MESSAGE); output="Your Payrate is $"+payrate+ " Perhour"; JOptionPane.showMessageDialog(null,output,"HourlyRate",JOptionPane.INFORMATION_MESSAGE); output="Your Regular Pay is$"+regular; JOptionPane.showMessageDialog(null,output,"40hour",JOptionPane.INFORMATION_MESSAGE); output="Your Over Time is$"+overtime; JOptionPane.showMessageDialog(null,output,"OverTime",JOptionPane.INFORMATION_MESSAGE); } } } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.