Need a Javascript program for an Employee class with a Constructor Function. It must contain properties of name, annualsalary and bonus of multiple employee of a company. It should contain a Method for calculateBonus. The bonus will be 20% of annualsalary. When the calculateBonus method is called, the bonus should be returned as the bonus's return value. Create a Function Called checkEmployee(). This Function when called will instantiate an employee Object Will Call the Employee's calculateBonus Method and when the Bonus is Returned, will use a simple javascript alert to display the name, annualSalary and their bonus.
<body>
<Input type="button" onclick="checkEmployee();">Check</Input>
</body>
<html>
<head>
<script type =
"text/javascript">
class Employee
{
constructor(name,annualSalary,Bonus)
{
this.name=name;
this.annualSalary=annualSalary;
this.Bonus=Bonus;
}
calculateBonus(annualSalary,Bonus)
{
alert(this.name,this.annualSalary,this.Bonus);
return
(annualSalary*this.Bonus)/100;
}
}
checkEmployee()
{
var emp = new Employee('chandana',100000,20);
emp.calculateBonus(this.annualSalary,this.Bonus);
}
</script>
</head>
<body>
<p>Click the following button
to call the function</p>
<form>
<input type =
"button" onclick = "checkEmployee()" value = "Call
Function">
</form>
</body>
</html>
Need a Javascript program for an Employee class with a Constructor Function. It must contain properties...
Write a javascript file Create an object constructor (using new and function ) to hold a recipes information. It has to include properties for title (a string), servings (a number), and ingredients (an array of strings). It also has to have a method called print(nOfServings). in your app, create a single object using this contractor and call its print method On separate lines (a Document.write() statement for each), log (display on console) the recipe information so it looks like: myObj.print(2)...
Need help with these scenarios Question 1 Write a JavaScript program to get the volume of a Cylinder with four decimal places using object classes. Volume of a cylinder : V = πr2h where r is the radius and h is the height of the cylinder. Your solution must include an HTML and a JavaScript file, with a button to create the cylinder, inputs for the cylinder's radius and height and an output to show the cyclinder's volume. Your solution...
Could you please help me write a Javascript code that will show a smiley face picture when I click the button. The picture should not display until the button is pressed. Here is my attempt at the code. It does not work. Please keep the code as simple as you can as I am new to coding. Please also use the <div> tag if possible, onclick and use the getElementById. Thank you <html> <body> <img id="exampleImage" src="smileyFace.png" /> <button onclick="pushButton()">Try...
HospitalEmployee Inheritance help please.
import java.text.NumberFormat;
public class HospitalEmployee
{
private String empName;
private int empNumber;
private double hoursWorked;
private double payRate;
private static int hospitalEmployeeCount = 0;
//-----------------------------------------------------------------
// Sets up this hospital employee with default
information.
//-----------------------------------------------------------------
public HospitalEmployee()
{
empName = "Chris Smith";
empNumber = 9999;
hoursWorked = 0;
payRate =0;
hospitalEmployeeCount++;
}
//overloaded constructor.
public HospitalEmployee(String eName,...
In an external JavaScript file, you need to create two global variables for the Quarter name array and the Sales amount array. Create an anonymous function and connect it to the onclick event of the Add to Array button that adds the values from the fields (Quarter and Sales) to the respective arrays. Create an anonymous function and connect it to the onclick event of Display Sales button displays the contents of the arrays, displays the sum of all the...
It must be C++
Chapter 13 Programming Challenge 2: Employee Class.
See instruction: Chapter 13 Programming Challenge 2 Employee
Class.pdf
Program Template:
// Chapter 13, Programming Challenge 2: Employee Class
#include <iostream>
#include <string>
using namespace std;
// Employee Class Declaration
class Employee
{
private:
string name; // Employee's name
int idNumber; // ID number
string department; // Department name
string position; // Employee's position
public:
// TODO: Constructors
// TODO: Accessors
// TODO: Mutators
};
// Constructor #1
Employee::Employee(string...
Build a class called Account.java. This class should have the following properties: AcctNo, Owner and balance. Also add the appropriate set and get methods, display method and main method. Main() should be used to test this class. In main() instantiate an Account object, fill it with data using the set methods, then call display to display the data.
QUESTION 35
When you've created a
data structure like this ____.
var rect = {length: 9,
width: 6};
you have created a
direct instance of an object
you have created an
object using a custom constructor function
you have created an
object literal
you have created an
array literal
QUESTION 38
"Once a web page has finished loading, then the ____ event
handler fires."
loaded
onload
complete
done
the language using in javascript
QUESTION 29 You have this form. Assume...
JavaScript expert, I need your help : My program doesn't work. I have the following program, it is simple web page: Create an object called person with name = John, age = 50. Then, access the object to display "John is 50 years old”. I have written some code here. Hint: Create an object with the var keyword, followed by a name and an "=" sign. Put the properties and values inside the {}; signs Note: Use getElementById() and innerHTML...