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

CODE SHOULD BE IN JAVA 1. Salaried employees, who are paid a fixed weekly salary

ID: 3805209 • Letter: C

Question

CODE SHOULD BE IN JAVA

1. Salaried employees, who are paid a fixed weekly salary regardless of the number of hours worked;

2. Hourly employees, who are paid by the hour and receive overtime pay;

3. Commissioned employees whose pays are 20% of the week's sales

- Create a console-based Java application that:
Calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee, type of employee, and the monthly salary, or hourly rate, if it’s an hourly employee, and hours worked for the week.

- For hourly employees, the rate will be doubled if it’s beyond 40 hours/week.
The application should then print out the name of the employee and the weekly pay amount. In the printout, display the dollar symbol ($) to the left of the weekly pay amount and format the weekly pay amount to display currency.

- Implements a feature that allows the company to reward selected salaried employees by adding 10% to their salaries. Your program should display an asterisk (*) to the upper right of the weekly pay amount, and a note stating bonus added below the table, as shown below:

Should look like this:

Rate Weekly Pay Amount Name Class Hours Sales $3,300.00 James Hogan Salaried $10.95 $547.50 Jennifer Waltz Hourly 45 32 $15.00 $480.00 Moly Smith Hourly $2,600.00 Joan Han Salaried Marry Butler Commissioned s 10,000 00 $2,000.00 TOTAL $8,827.50 *A 10% bonus is awarded

Explanation / Answer

WagwCalcu.java Class

public class WageCalcu
{
private String employeeName,employeeType;
private int hours;
private double rate, pay,msalary;

public void setEmployeeName ( String name )
{
employeeName = name;
}
public String getEmployeeName()
{
return employeeName;
}
public void setEmployeeType ( String type )
{
employeeType = type;
}
public String getEmployeeType()
{
return employeeType;
}
  
public double calculatePay( int hours, double rate )
{
if ( hours > 40 )
{
pay = 2*( hours * rate );
}
else pay = hours * rate;

return pay;
}
public void displayWeeklyEmployee()
{
System.out.printf( "Employee's name:", getEmployeeName() );
System.out.printf( "Employee's type:", getEmployeeType() );
System.out.printf( " Gross Salary: $ %f", pay);
}
public void displayMonthlyEmployee()
{
System.out.printf( "Employee's name:", getEmployeeName() );
System.out.printf( "Employee's type:", getEmployeeType() );
System.out.printf( " Gross Salary: $ %f", msalary);
}
}

Employee.java class

import java.util.Scanner;
public class Employee
{
public static void main(String[] args)
{
Scanner input = new Scanner( System.in);
WageCalcu employee = new WageCalcu();

System.out.print( "Enter Employee name: " );
String name = input.nextLine();
employee.setEmployeeName( name );
System.out.print( "Enter type of Employee: " );
String type = input.nextLine();
employee.setEmployeeType( type );
if (type == "hourly")
{
System.out.print( "Enter how many hours worked: " );
int hours = input.nextInt();

System.out.print( "Enter hourly rate: " );
double rate = input.nextInt();

employee.calculatePay( hours, rate );
employee.displayWeeklyEmployee();
  
System.out.println();
}
else
{
System.out.print( "Enter monthly salary : " );
double msalary = input.nextInt();
//employee.calculatePay( hours, rate );
employee.displayMonthlyEmployee();
  
System.out.println();
}
}
}

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