68 322
Assignments Done
99%
Successfully Done
In November 2018

# Answer to Question #57047 in Java | JSP | JSF for Christian Josef Aquino

Question #57047
Write a JAVA program that will input Employee Name, Rate per hour, No. of hours worked
and will compute the daily wage of an employee. If the number of hours worked exceeds
eight hours add 30% to each excess hours as overtime rate.
Formula: Daily Wage = Rate per hour * No. of hours worked + OT pay
package com.company;

public class Main {

public static void main(String[] args) throws Exception {
double daily_wage = 0;
System.out.println("Enter Employee Name");
System.out.println("Enter Rate per hour");
System.out.println("Enter No. of hours worked");
double rate;
int hours;
try {
rate = Float.parseFloat(rate_str);
hours = Integer.parseInt(hours_str);
daily_wage = compute_daily_wage(rate,hours);
} catch (NumberFormatException e) {
System.err.println("Wrong format of data!");
}
System.out.println(employee_Name + "'s daily wage " + " - " + daily_wage);
}
public static double compute_daily_wage(double rate, int hours){
double ot_pay = 0;
if(hours > 8)
ot_pay = rate * 30 / 100 * (hours - 8);
return rate * hours + ot_pay;
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!