0% found this document useful (0 votes)
4 views2 pages

JavaScript Constructor Functions Guide

The document outlines the creation of three constructor functions in JavaScript. The first function calculates bonuses for people based on salary and years of experience. The second function categorizes students based on their grades within a department, and the third function checks patient appointments to send notifications for weekend appointments.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

JavaScript Constructor Functions Guide

The document outlines the creation of three constructor functions in JavaScript. The first function calculates bonuses for people based on salary and years of experience. The second function categorizes students based on their grades within a department, and the third function checks patient appointments to send notifications for weekend appointments.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1, Create a Constructor function that takes an array of people objects (each with a salary),

and adds a bonus based on their salary rules:

Adds 3% bonus if salary < 50,000 ,

Adds 1% bonus if salary between 50,000 and 100,000

Adds no % bonus if salary > 100,000

Additionally, if years of experience > 10, adds a flat 3000 bonus

Otherwise, adds a flat 1000 bonus

2. Create two constructor functions: one for a Student and one for a Department. Student
should have a name and a grade as a parameter. Add multiple students to the Department,
Department should have Department name as a parameter. Based on each student’s
grade, categorize them as an 'Excellent Student', a 'Medium Student', or a 'You Need to
Work' student.

Two constructor functions: Student and Department

Each Student has a name and grade

Students are added to a Department

Each student is categorized based on their grade:

• ≥ 85: Excellent Student

• 60 - 84: Medium Student

• < 60: You Need to Work

3. write a constructor function that checks a list of patient appointments, and sends a
notification on friday if their appointment is on Sunday or Saturday. The patient constructor
should take name, appointmentDate parameters. Use date object.

You might also like