Question
I need some assistance with javascript functions. The following is what I am trying to do and need the two functions specified below to work
I need some assistance with javascript functions. The following is what I am trying to do and need the two functions specified below to work according to what is stated:
Using the paycheck2.html program you created prior, save it as paycheck3.html. Change it up a bit ask the user for the pay rate and the hours, and then validate them (as opposed to one at a time). This isnt optimal, but the goal here is to assess you passing data between functions.
Heres how to do it: Create one function named payValidate, which validates that the pay rate and number of hours are valid. Create another function named calculateNet, which determines gross pay, withholding, and net pay.
The payValidate function should : Validate both pieces of data. If either is invalid, the function should take care of continually prompting the user for valid input Once both pieces of data are valid, pass both pieces of data to the calculateNet function Pass net pay back to main part of program
The calculateNet function should: Calculate gross pay, withholding, and net pay Pass net pay back to the payValidate function
Did you do it right? You should be able to answer YES to the following 1. Are there only two functions? 2. Does the payValidate function get called from the main program and passed the pay rate and hours? 3. Does the payValidate function validate both pieces of data 4. Does the payValidate function pass both pieces of data to the calculateNet function? 5. Does the calculateNet function determine net pay and pass it back to the payValidate function? 6. Does the payValidate function pass the net Pay back to the main program? 7. Does the main program display the net pay?
The following is what I have done for paycheck2:
The parameters for paycheck2 are hours between 1 and 60 and pay between $7.25 and $20. We are supposed to alert them if they give an invalid response to enter again. For paycheck 3, the instructions are above with same restrictions for hours and pay. The instructions also mention a withholding and a net pay, but no withholding figure was given, so I'm going with 10% for the time being. Here is what I've done for paycheck3 so far, and I feel like I am really far off from what the instructions describe, so any help is appreciated:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started