programmingex4 23 java

Solutions on MaxInterview for programmingex4 23 java by the best coders in the world

showing results for - "programmingex4 23 java"
Fabian
13 Jan 2017
1import java.util.Scanner;
2 
3public class ProgrammingEx4_23 {
4 
5 public static void main(String[] args) {
6  Scanner input = new Scanner(System.in);
7  System.out.print("Enter employee's name:");
8  String name = input.nextLine();
9 
10  System.out.print("Enter number of hours worked in a week:");
11  double hours = input.nextDouble();
12 
13  System.out.print("Enter hourly pay rate:");
14  double rate = input.nextDouble();
15 
16  System.out.print("Enter federal tax withholding rate:");
17  double ftax = input.nextDouble();
18 
19  System.out.print("Enter state tax withholding rate:");
20  double stax = input.nextDouble();
21 
22  System.out.println("Employee Name:" + name);
23  System.out.println("Hours Worked:" + hours);
24  System.out.println("Pay Rate: $" + rate);
25  System.out.println("Gross Pay: $" + rate * hours);
26  System.out.println("Deduction:");
27  System.out.printf("Federal Withholding (%.1f%%): $%.2f\n", ftax * 100,
28    ftax * rate * hours);
29  System.out.printf("State Withholding (%.1f%%): $%.2f\n", stax * 100,
30    stax * rate * hours);
31  System.out.printf("Total Deduction: $%.2f\n", (stax + ftax) * rate
32    * hours);
33  System.out.printf("Net Pay: $%.2f\n", (1 - stax - ftax) * rate * hours);
34 
35 }
36 
37}
38
similar questions
queries leading to this page
programmingex4 23 java