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

I need help with designing the logic and in writing the nested if statementand k

ID: 3684399 • Letter: I

Question

I need help with designing the logic and in writing the nested if statementand knowing where to put the information in the code. Input Employee's name: Kim Smith; Number of shifts: 25; Number of transactions: 75; Transaction dollar value: 40,000.00 Productivity score/ Bonus<=30 is $50; 31-69 is $75; 70-199 is $100 >=200 is $200 Output: Employee name: Kim Smith Employee Bonus:$50 for / EmployeeBonus.java - This program calculates an employee's productivity bonus. import javax.swing.*; public class EmployeeBonus { public static void main(String args[]) { // Declare and initialize variables here. String employeeName; double numTransactions; String transactString; double numShifts; String shiftString; double dollarValue; String dollarString; double score; double bonus; final double BONUS_1 = 50.00; final double BONUS_2 = 75.00; final double BONUS_3 = 100.00; final double BONUS_4 = 200.00; // This is the work done in the housekeeping() method employeeName = JOptionPane.showInputDialog("Enter employee's name: "); shiftString = JOptionPane.showInputDialog("Enter number of shifts: "); transactString = JOptionPane.showInputDialog("Enter number of transactions: "); dollarString = JOptionPane.showInputDialog("Enter transactions dollar value: "); numShifts = Double.parseDouble(shiftString); numTransactions = Double.parseDouble(transactString); dollarValue = Double.parseDouble(dollarString); // This is the work done in the detailLoop() method // Write your code here // This is the work done in the endOfJob() method // Output. System.out.println("Employee Name: " + employeeName); System.out.println("Employee Bonus: $" + bonus); System.exit(0); } }

Explanation / Answer

EmployeeBonus.java


import javax.swing.*;
public class EmployeeBonus {
   public static void main(String args[]) {
   // Declare and initialize variables here.
   String employeeName;
   double numTransactions;
   String transactString;
   double numShifts;
   String shiftString;
   double dollarValue;
   String dollarString;
   double score;
   double bonus = 0;
   final double BONUS_1 = 50.00;
   final double BONUS_2 = 75.00;
   final double BONUS_3 = 100.00;
   final double BONUS_4 = 200.00;
   // This is the work done in the housekeeping() method
   employeeName = JOptionPane.showInputDialog("Enter employee's name: ");
   shiftString = JOptionPane.showInputDialog("Enter number of shifts: ");
   transactString = JOptionPane.showInputDialog("Enter number of transactions: ");
   dollarString = JOptionPane.showInputDialog("Enter transactions dollar value: ");
   numShifts = Double.parseDouble(shiftString);
   numTransactions = Double.parseDouble(transactString);
   dollarValue = Double.parseDouble(dollarString);
   // This is the work done in the detailLoop() method
   // Write your code here
   int numofTran = Integer.parseInt(shiftString);
   if(numofTran <=30){
       bonus = BONUS_1;
   }
   else if(numofTran > 30 && numofTran < 70){
       bonus = BONUS_2;
   }
   else if(numofTran >= 70 && numofTran < 200){
       bonus = BONUS_3;
   }
   else if(numofTran >= 200){
       bonus = BONUS_4;
   }  

   // This is the work done in the endOfJob() method
   // Output.
   System.out.println("Employee Name: " + employeeName);
   System.out.println("Employee Bonus: $" + bonus);
   System.exit(0);
   }
}

Output:

Employee Name: Kim Smith
Employee Bonus: $50.0

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