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.
1
Expert's answer
2012-12-11T09:20:38-0500
import java.util.Scanner;
public class Salary {
public static void main (String... args) {
Scanner scanner = newScanner(System.in);
System.out.print(" 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; default:System.exit(0); } System.out.print(" Enternumber of hours the employee work :"); int hours = scanner.nextInt(); System.out.print(" Employee salary is "+ hourlyRate*hours); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment