Write a function to compute the amount of taxes

Assignment Help JAVA Programming
Reference no: EM131373595

Assignment: Javascript Payroll

1. In a separate JS file, write a function to calculate gross wages for an hourly employee. The function should receive two parameters: the pay rate (dollars per hour, a floating point number) and the hours worked. Hours from 0 through 40 are "straight time" pay, and any hours in excess of 40 are overtime pay at 1.5 times the standard rate (hint: use the ? : operator to make a decision about pay rates). The function should return a floating point number representing the gross pay amount. Note, the function should not do any output such as document.writeln or alerts.

2. In a separate JS file, write a function to compute the amount of taxes that should be withheld from a paycheck based on the gross pay. The function should receive one parameter, the gross pay. Withholdings are calculated based on the following table:

Category

Percentage

Federal taxes

31%

State taxes

8%

Local taxes

2%

All local taxes are deductable from the gross amount used to calculate state taxes. Likewise all state and local taxes are deductable from the gross amount used to calculate federal taxes. The function should accept one parameter, the gross pay, and return one result, the total withholdings based on the above table and rules. Again, the function should not do any output, but should just return a number. Here is an example:

Input: 1000.00, return 377.90. Why not just 41% of 1000 = 410? 2% of $1000.00 is $20.00. Now subtract the $20.00 out of the gross, leaving $980.00 as the base for calculating state taxes. 8% of $980.00 is $78.40. Subtract $78.40 from the $980.00 to get $901.60, the base for calculating federal taxes. 31% of $901.60 is $279.50 (rounded to the nearest penny). When $20.00, $78.40, and $279.50 are added together, the result is $377.90, which is the answer that should be returned from the function. Note that these numbers are rounded to the nearest penny, which is possible with either the .toFixed() method of a number or by using Math.round().

Reference no: EM131373595

Questions Cloud

Calculate the expected primary consolidation settlement : Calculate the expected primary consolidation settlement. The results of a consolidation test on the clay are given below.
What can they learn from the adopting innovation : What can they learn from the adopting innovation -  How can this be used to maintain a competitive edge?
Confidence interval for the average caloric content : Give a 95% confidence interval for the average caloric content of a 3-ounce cut of top loin steak. Also give a 98% confidence interval for the average caloric content of a cut.
Find the undrained and drained friction angles for the soil : A pore water pressure sensor recorded an excess pore pressure, (µd)f = 27.6 kN/m2 at failure. Determine the undrained and drained friction angles for the soil.
Write a function to compute the amount of taxes : ITEC 136- In a separate JS file, write a function to compute the amount of taxes that should be withheld from a paycheck based on the gross pay. The function should receive one parameter, the gross pay.
Create a list of steps for patient care : Create a list of steps for patient care. Then practice care of the fallen patient following your checklist. Submit for points.
Confidence interval for average monthly number of takeoffs : Landings and takeoffs at Schiphol, Holland, per month are (in 1,000s) as follows:- Assume a random sample of months. Give a 95% confidence interval for the average monthly number of takeoffs and landings.
How do we define an individual : How do we define an individual? Does asexual reproduction make it difficult to define what constitutes an individual within a population? Also, how does asexual reproduction allow for evolution? Relate this to antibiotic resistance in bacteria.
Stove and accidently touches the burner : Amy is cooking dinner for her family. She moves to pull a pot off the stove and accidently touches the burner. She reflexively pulls her finger away from the stove and immediately feels the pain.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Declare another television object called portable

Add to the comment header as indicated at the top of the program.

  Implement a custom environment for your maze game

ITECH7201 Software Engineering - Design and implement a custom environment for your maze game. This requires producing your own unique hand-drawn map of the maze game environment.

  Data about a virtual memory system

You are given the following data about a virtual memory system: (a) The TLB can hold 1024 entries and can be accessed in 1 clock cycle (1 nsec).

  1 write an application class that contains several

1 write an application class that contains several methods.nbspthe first method should be named greeting and should

  Prepare a demo program

Design, and implement a class that will be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 39 marked on the edge, and it has a three-number combination, which we will call x,y,z.

  Question 1when you use the mvc pattern the controller

question 1when you use the mvc pattern the controller directs the flow of control toa. the browser and the modelb. the

  User to input a decimal number and ouputs the number

Write a program that prompts the user to input a decimal number and ouputs the number rounded to the nearest integer.Remember the rules around proper development style and form, including adding comments. A software developer should always add commen..

  Write a method called writenums

Write a method called writeNums that takes an integer n as a parameter and prints to the console the first n integers starting with 1 in sequential order, separated by commas. For example, consider the

  Write a program to print all armstrong numbers

Write a program to print all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number

  Advantages of the java object class structure

Discussion Question: What are the advantages of the Java object class structure with its instance fields and methods

  Draw the uml diagram for the class

Draw the UML diagram for the class and then implement the class. Write a program that creates two rectangles objects, one with width 4 and height 40 and the other with width 3.5 and height 35.9

  What is overloading and what is overriding

What is overloading and what is overriding? Wrtie JAVA code code to explain it.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd