Answer to Question #260668 in Java | JSP | JSF for Mark

Question #260668


USING IF ELSE CONDITIONAL STATEMENT


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 hour as overtime rate. 

Formula: Daily Wage = Rate per hour * No. of hours worked + OT pay


1
Expert's answer
2021-11-03T11:44:04-0400


package dailywage;


import java.util.Scanner;




public class DailyWage {


    
    public static void main(String[] args) {
         System.out.println("Enter the Employee Name: \n");
        Scanner scan = new Scanner(System.in);
        
       String EmployeeName = scan.nextLine();
       
       System.out.println("Enter the Rate per hour: \n");
       
       double rate = scan.nextDouble();
       
       System.out.println("Enter the No. of hours worked: \n");
       
       double hours = scan.nextDouble();
       
       double daily_wage = 0;
       if(hours > 8){
           daily_wage = rate * hours + (hours - 8) * 0.3;
       }
       else{
           daily_wage = rate * hours;
       }
       
       System.out.println("Total Tuition Fee is: \n"+daily_wage);
    }
    
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS