I need to create this coding: (JAVA PROGRAMMING) Write a program by creating an Employee class. This class has three instance variables: name, which is a String representing the name of the Employee numberOfHoursPerDay, which is an int representing the number of hours the employee has worked per day salary, which is an int representing the salary of the employee per-hourly basis 1. Create getter and setter methods of all the instance variables 2. Write a constructor for the class Employee, which takes a String representing the name 3. Write a method getInfo() which takes the salary, number of hours of work per day of an employee as a parameter 4. Write a method addSal() which adds $10 to the salary of the employee if it is less than $500. 5. Write a method addWork() which adds $5 to the salary of the employee if the number of hours of work per day is more than 6 hours. 6. Write a caller class and create an object of class Employee then call the methods getInfo, addSal, addWork and print the salary of the employee
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
I need to create this coding: (JAVA
Write a program by creating an Employee class. This class has three instance variables:
- name, which is a String representing the name of the Employee
- numberOfHoursPerDay, which is an int representing the number of hours the employee has worked per day
- salary, which is an int representing the salary of the employee per-hourly basis
1. Create getter and setter methods of all the instance variables
2. Write a constructor for the class Employee, which takes a String representing the name
3. Write a method getInfo() which takes the salary, number of hours of work per day of an employee as a parameter
4. Write a method addSal() which adds $10 to the salary of the employee if it is less than $500.
5. Write a method addWork() which adds $5 to the salary of the employee if the number of hours of work per day is more than 6 hours.
6. Write a caller class and create an object of class Employee then call the methods getInfo, addSal, addWork and print the salary of the employee
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images