In this lab, you complete a Java program with the provided data files. The program calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take-home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay. Instructions Ensure the file named Payroll.java is open. Variables have been declared and initialized for you as needed, the output statements have been written and the input object has been declared and initialized for you. Read the code carefully before you proceed to the next step. Write the Java code needed to perform the following: Calculate state withholding tax (stateTax) at 6.5 percent Calculate federal withholding tax (federalTax) at 28.0 percent. Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent. Calculate total withholding (totalWithholding) as stateTax + federalTax + dependentDeduction. Calculate take-home pay (takeHomePay) as salary minus total withholding. Compile and execute your program by clicking the Runbutton. You should get the following output:State Tax: $81.25 Federal Tax: $350.00000000000006 Dependents: $62.5 Salary: $1250 Take-Home Pay: $756.25 In this program, the variables salary and numDependentsare initialized with the values 1250.00 and 2. To make this program more flexible, modify it to accept interactive input for salary and numDependen

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Understanding Sequential Statements

Summary

In this lab, you complete a Java program with the provided data files. The program calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take-home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay.

Instructions

  1. Ensure the file named Payroll.java is open.

  2. Variables have been declared and initialized for you as needed, the output statements have been written and the input object has been declared and initialized for you. Read the code carefully before you proceed to the next step.

  3. Write the Java code needed to perform the following:

    • Calculate state withholding tax (stateTax) at 6.5 percent
    • Calculate federal withholding tax (federalTax) at 28.0 percent.
    • Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.
    • Calculate total withholding (totalWithholding) as stateTax + federalTax + dependentDeduction.
    • Calculate take-home pay (takeHomePay) as salary minus total withholding.
  4. Compile and execute your program by clicking the Runbutton. You should get the following output:State Tax: $81.25 Federal Tax: $350.00000000000006 Dependents: $62.5 Salary: $1250 Take-Home Pay: $756.25
  5. In this program, the variables salary and numDependentsare initialized with the values 1250.00 and 2. To make this program more flexible, modify it to accept interactive input for salary and numDependents.
Done <
AA
delmarlearning.com
|
Understanding
Payroll.java
>- Terminal
Sequential
1// This program calculates an employee's take home
рay.
Statements
2 import java.util.Scanner%;
4 public class Payroll
/3
Summary
5 {
public static void main(String args [1)
In this lab, you complete a Java
{
program with the provided data
8.
Scanner s = new Scanner(System.in);
6.
double salary = 1250.00%;
%3D
files. The program calculates the
10
double stateTax;
amount of tax withheld from an
11
double federalTax;
employee's weekly salary, the tax
double numDependents = 2;
12
%3D
deduction to which the employee
13
double dependentDeduction;
is entitled for each dependent,
14
double totalWithholding;
15
double takeHomePay;
and the employee's take-home
16
pay. The program output includes
// Calculate state tax here.
17
state tax withheld, federal tax
18
withheld, dependent tax
System.out.println("State Tax: $" +
19
stateTax);
deductions, salary, and take-home
20
// Calculate federal tax here.
pay.
21
22
System.out.println("Federal Tax: $" +
Instructions
federalTax);
23
// Calculate dependant deduction here.
24
1. Ensure the file named
25
System.out.println("Dependents: $" +
Payroll.java is open.
dependentDeduction);
26
// Calculate total withholding here.
2. Variables have been declared
27
and initialized for you as
// Calculate take home pay here.
28
3.
6,
7,
Transcribed Image Text:Done < AA delmarlearning.com | Understanding Payroll.java >- Terminal Sequential 1// This program calculates an employee's take home рay. Statements 2 import java.util.Scanner%; 4 public class Payroll /3 Summary 5 { public static void main(String args [1) In this lab, you complete a Java { program with the provided data 8. Scanner s = new Scanner(System.in); 6. double salary = 1250.00%; %3D files. The program calculates the 10 double stateTax; amount of tax withheld from an 11 double federalTax; employee's weekly salary, the tax double numDependents = 2; 12 %3D deduction to which the employee 13 double dependentDeduction; is entitled for each dependent, 14 double totalWithholding; 15 double takeHomePay; and the employee's take-home 16 pay. The program output includes // Calculate state tax here. 17 state tax withheld, federal tax 18 withheld, dependent tax System.out.println("State Tax: $" + 19 stateTax); deductions, salary, and take-home 20 // Calculate federal tax here. pay. 21 22 System.out.println("Federal Tax: $" + Instructions federalTax); 23 // Calculate dependant deduction here. 24 1. Ensure the file named 25 System.out.println("Dependents: $" + Payroll.java is open. dependentDeduction); 26 // Calculate total withholding here. 2. Variables have been declared 27 and initialized for you as // Calculate take home pay here. 28 3. 6, 7,
Expert Solution
Step 1

Actually, java is a object oriented programming language.

It is a platform independent.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education