77 964
Assignments Done
Successfully Done
In August 2019

Answer to Question #20407 in Java | JSP | JSF for shalenee

Question #20407
Write a program that calculates the salary for the employee. The hourly rate for permanent staff (P) is 200, contract staff (C) is 150 and temporary staff (T) is 100. The program accepts the employee type and the number of hours the employee work.
Expert's answer
import java.util.Scanner;

public class Salary {

public static void main (String... args) {

Scanner scanner = newScanner(System.in);

Enteremployee type (permanent(P) contract(C) temporary(T):");
char staffType = scanner.nextLine().toLowerCase().charAt(0);
int hourlyRate=0;
switch (staffType) {
case 'p' :hourlyRate=200; break;
case 'c' :hourlyRate=150; break;
case 't' :hourlyRate=100; break;
Enternumber of hours the employee work :");
int hours = scanner.nextInt();
Employee salary is "+ hourlyRate*hours);


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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions