Question

Directions: Read the scenario for each problem as well as the JavaScript code. Circle the programming...

Directions: Read the scenario for each problem as well as the JavaScript code. Circle the programming error (logical or syntax) . threr is 8 errors . please hightlight errors.

  • Create two functions for the following scenario. Function 1: Write a two-argument function to calculate a person’s holiday bonus based on the total number of hours worked during the past four weeks and whether the employee is full-time (FT) or part-time (PT). Function 2: Write a second function to see if the same employee qualifies for health care coverage based on his/her job status.

NOTE: If an employee worked over 120 hours and is full-time (FT), the bonus will be $100. Otherwise, the bonus paid be $30. Also, if an employee is full-time (FT), he/she qualifies for health coverage.

script code :

1          // Function Definition

2          function 2holidayBonus (hrsWorkedF, jobStatusF) {

3          if (hrsWorkedF > 120 && jobStatusF = “FT”) {

4          var bonus = $100;

5          }

6          else

7          var bonus = 30;

8          }

9          document.write (“Holiday Bonus: $” + bonus.ToFixed(2) + “<br>”);

10         return;

11        }

12        function healthCoverage (jobF) {

13        if (jobF = “FT”) {

14        var status = “Yes”;

15        }

16        else {

17        var status = No;

18        }

19        document.write (“Health Eligibility: ” + status + “<br>”);

20        return;

21        }

22        // Main Program

23        var hrsWorked = prompt (“Enter the total number of hours worked”);

24        hrsWorked = Number (hrsWorked);

25        var jobStatus = prrompt (“Enter job status: FT or PT”);

26        jobStatus = Number (jobStatus);

27        2holidayBonus (hrsWorked, jobStatus);

28        healthCoverage (jobStatus);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Firstly I have attached image where you can find Syntax and Logical Errors.

Please have a thorough look at it.

Now below is the updated code for your reference with explanation through comments.

// CODE STARTS NOW

//Function Definition

//FUNCTION RENAMED

function holidayBonus(hrsWorkedF, jobStatusF) {

if (hrsWorkedF > 120 && jobStatusF == 'FT') { //CONDITION UPDATED

var bonus = 100; // $ SIGN REMOVED

} else

{

var bonus = 30;

}

document.write("Holiday Bonus: $" + bonus + "<br>" );

return;

}

function healthCoverage(jobF) {

if (jobF == 'FT') {   // CONDITION UPDATED

var status = 'Yes'; // SINGLE QUOTES USED

} else {

var status = 'No'; // SINGLE QUOTES ADDED

}

document.write("Health Eligibility: " + status + "<br>" );

return;

}

// Main Program

var hrsWorked = prompt('Enter the total number of hours worked');

// NUMBER FUNCTION REMOVED

var jobStatus = prompt('Enter job status: FT or PT');

// NUMBER FUNCTION REMOVED

holidayBonus(hrsWorked, jobStatus); //FUNCTION RENAMED

healthCoverage(jobStatus);

// END OF CODE

Please rate if the solution works and you find it useful.

name does'nt start with number Function in J.s. condihon is cheeked ey using, 'FT' vaniable shru number function 2holidayBonus (hrsWorked F, jobStatusF) { if (hrsWorkedF > 120 && jobStatusF = "FT"){ var bonus $100; else missing bracket var bonus =30: document write (Holiday Bonus: $+ bonus.ToFixed (2) + "<br>"); return; not needed function healthCoverage (jobF) { if (jobF= "FT") { omect synte. (jobf = 'FT) var status = "Yes' } else { Single Quotes must be used. var status = No } document.write ("Health Eligibility: +status + "br> "); return; //Main Program var hrsWorked = prompt(Enter the total number of hours worked") hrsWorked Number (hrsWorked); 2 var jobStatus = prrompt (Enter job status: FT or PT"), D jobStatus = Number (jobStatus); 2holidayBonus (hrsWorked, jobStatus); healthCoverage (jobStatus); don't use number as start for funchon. single quotes uSint pompt always use syntax prompt ('Something '); when cerect var hrsworkeod need to convert There is no 4var jobstatus to Nomber, we ta ke Frr m. and String fom prompt mpare in funchin using Valve Var.

Add a comment
Know the answer?
Add Answer to:
Directions: Read the scenario for each problem as well as the JavaScript code. Circle the programming...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SESSION 12 Workers for Ivanka's clothing company The reality of working in a factory making clothes...

    SESSION 12 Workers for Ivanka's clothing company The reality of working in a factory making clothes for Ivanka Trump’s label has been laid bare, with employees speaking of being paid so little they cannot live with their children, anti-union intimidation and women being offered a bonus if they don’t take time off while menstruating. The Guardian has spoken to more than a dozen workers at the fashion label’s factory in Subang, Indonesia, where employees describe being paid one of the...

  • Super stuck on a couple of questions on this scenario. Advanced Scenario 7: Mark and Barbara...

    Super stuck on a couple of questions on this scenario. Advanced Scenario 7: Mark and Barbara Matthews Directions Using the tax software, complete the tax retum, including Form 1040 and all appropri- ate forms, schedules, or worksheets. Answer the questions following the scenario. Note: When entering Social Security numbers (SSNS) or Employer identification Numbers (EINS), replace the Xs as directed, or with any four digits of your choice. Interview Notes • Mark and Barbara are married and want to file...

  • Subject: HRM Introduction and Instructions You have recently been hired as the Director of Human Resources...

    Subject: HRM Introduction and Instructions You have recently been hired as the Director of Human Resources for Wilson Brothers Canada and have HR responsibility for all of the company’s Canadian operations. Bob and John Wilson have asked you to prepare a report for their review focusing specifically on organizational behavior within the company. Review the Wilson Brothers Case Scenario in depth and address the required topic listed below in your analysis report. Marks are allocated for thoroughness of coverage of...

  • Amazon to Competition: We Will Crush You! Amazon to Employees: We Will Churn You! Globally, Amazon...

    Amazon to Competition: We Will Crush You! Amazon to Employees: We Will Churn You! Globally, Amazon is one of the largest and most successful companies in any industry. Technological innovation has contributed to its success, as has its employee acquisition practices, which are exceptionally high. The question is what has allowed this company to thrive and maintain its success? This activity is important because it shows how companies like Amazon hire based on personality and individual differences. Such companies place...

  • Comprehensive Problem 6-52 (LO 6-1, LO 6-2, LO 6-3) [The following information applies to the questions...

    Comprehensive Problem 6-52 (LO 6-1, LO 6-2, LO 6-3) [The following information applies to the questions displayed below.] Read the following letter and help Shady Slim with his tax situation. Please assume that his gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2019 To the friendly student tax preparer: Hi, it’s Shady Slim again. I just got back from my 55th birthday party, and I’m told that you need some more information...

  • In your judgement, and given only the facts described in this case, should the management of...

    In your judgement, and given only the facts described in this case, should the management of Massey energy Company be held morally responsible for the deaths of the 29 miners? Explain in detail. Suppose that nothing more is learned about the explosion other than what is described in this case. Do you think Don Blankership should be held morally responsible for the deaths of the 29 miners? Explain in detail. Given only the facts described in this case, should the...

  • Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first...

    Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first summer job. Even though his parents are claiming him as a dependent he wants to file a return in order to get his refund. He receives his W-2 and decides he can do his own return using form 1040-EZ. Which of the following information is not found on a Form W-2? a) The taxpayer’s Social Security number b) The taxpayer’s wages, tips and other...

  • Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around...

    Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around risk and threat management, fostering an environment in which objectives seem clear: manage risk, manage threat, stop attacks, identify attackers. These objectives aren't wrong, but they are fundamentally misleading.In this session we'll examine the state of the information security industry in order to understand how the current climate fails to address the true needs of the business. We'll use those lessons as a foundation...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT