1. 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
1
Expert's answer
2015-12-02T08:01:19-0500
/* * Program's input: Employee Name, Rate per hour, No. of hours worked. * This program calculate the daily wage of an employee. */ package employee;
import java.util.Scanner;
public class Employee {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); double DailyWage = 0, otPay = 0;
System.out.println("Please, enter Employee Name"); String name = sc.nextLine(); System.out.println("Please, enter Rate per hour"); int rate = Integer.parseInt(sc.nextLine()); System.out.println("Please, enter No. of hours"); int hours = Integer.parseInt(sc.nextLine()); if (hours>8) otPay = (hours-8)*0.3*rate; DailyWage = rate*hours + otPay; System.out.println("========================="); System.out.println(name + " daily wage - " + DailyWage);
Comments
Leave a comment