Write function to calculate gross wages for hourly employee

Assignment Help JAVA Programming
Reference no: EM131396215

Assignemnt

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: EM131396215

Questions Cloud

Criticize the given definitions - a house is a structure : Criticize the following definitions in light of the eight rules for lexical definitions:- A house is a structure made of wood or stone intended for human habitation.
Purchasing agent for a municipality : The purchasing agent for a municipality has contracted with a local car dealer to purchase four cars. The dealer has 25 cars on his lot; 10 red, 7 blue, 6 white, and 2 purple.
When an organization is preparing to outsource : When an organization is preparing to outsource and staff may/could lose their positions, what do you think is their biggest need from the organization?
Criticize the given definition - satire is a kind of glass : Criticize the following definitions in light of the eight rules for lexical definitions:- Satire is a kind of glass, wherein beholders do generally discover everybody's face but their own.
Write function to calculate gross wages for hourly employee : 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.
Purchase and the decision making process : Consider your last vehicle purchase and the decision making process you engaged in while deciding what vehicle to purchase or if a new vehicle was the right decision. While analyzing your decision, keep in mind that everything from the interest ra..
Criticize the given definitions - a carpenters square : Criticize the following definitions in light of the eight rules for lexical definitions:- A carpenter's square is a square used by a carpenter.
Fall in the price of televisions : Then, show how the wage changes in Canada due to a fall in the price of televisions, holding constant the price of timber. Can we predict that change in real wages?
Motivation - understanding self and others : Create a summary of the reading, also, develop two critical questions rising from the reading along with two ideas/concepts that you have found enlightening or thought to provoke.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Prompts user to type a negative number

Displays Quotient and Remainder of above two inputs, Prompts user to type a negative number to exit and any other number to continue

  Implement a class person with two fields name and age

Implement a class Person with two fields name and age, and a class Car with three fields

  Create the default junit tests using netbeans

Create the 'default' JUnit tests using NetBeans. Do this for the HomeAppliance class only; not for your JFrame GUI class.

  Use of java api to perform interactive i/o in java

To gain experience designing and writing your own Java Program, To use of Java APIs to perform interactive I/O in Java programming, To declare variables and constants appropriately

  Discuss the pros and cons of compilers and interpreter

Pick a problematic situation that you think a Java program can solve or make easier.

  Java coding if-else while loop

Code a while loop that keeps printing "You are a DEDICATED student!" as long as the user enters an attendance rate of 90% or greater. Assume the loop-control variable, attendance, is already declared along with input for the Scanner class. The w..

  Write java program that demonstrates exception handling

You will write a Java program that demonstrates exception handling. Your program will accept from the user ten values and place those numbers in an array

  Design a solution to the problem by using the five steps to

the software needs to allow the restaurant owner to schedule employees for up to 40 hours in a seven-day week. the

  Write a portion of a program for a church website

Write a portion of a program for a church's website. The program will be used for a chatting feature, which should include an Input Box that requests the user's name.  The message box should include the user's name and the Scripture of the Day (ch..

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Huge integer class

Huge Integer Class) Create a class HugeInteger which uses a 40-element array of digits to store integers as large as 40 digits each. Provide methods parse, toString, add and subtract. Method parse should receive a String, extract each digit using met..

  Create a controller class that implements an fcfs schedule

Create a controller class that implements an FCFS schedule and instantiates 5 objects of each class and runs each object - write to the system out a number of times.

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