Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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().

Java, Programming

  • Category:- Java
  • Reference No.:- M92183430
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Java

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As