Answer to Question #322993 in Java | JSP | JSF for Toiler Gamer

Question #322993

Q: Write a program that displays the following menu to the user:

Press 1 for Permanent Employee

Press 2 for Daily wages Employee

After selecting the appropriate employee calculate salary for the employees.

The daily wages employees are paid 400 per hour while permanent employees are paid 800 per hour. First you need to ask for the number of hours for which the employee has worked so far and then calculate and display the salary of each type of employee.

Perform the above-mentioned task using switch statement. 


1
Expert's answer
2022-04-03T13:30:45-0400
import java.util.Scanner;

public class MyMainClass {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);


        System.out.print(   "Press 1 for Permanent Employee\n" +
                            "Press 2 for Daily wages Employee\n" +
                            "Enter: ");
        int v = in.nextInt();

        System.out.print("Enter the number of hours worked: ");
        int ho = in.nextInt();

        switch(v){
            case 1:
                System.out.print("Employee salary = " + (ho*800));
                break;
            case 2:
                System.out.print("Employee salary = " + (ho*400));
                break;
        }


    }
}

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