Write the definition of a class named Employee to hold the data of the working hours of employees and their salaries in a company. The class includes the following private data members: • Name: to represent employee's name • ID: to represent employee's ID • NumberHours: an array of type integer of size 24 to save the number of hours worked by the employee during the days of the month. • Price: to represent the price per hour. Additionally, the class should include: • A constructor that takes three parameters to initialize the instance variables Name, ID and price and create the array NumberHours. • A method SetHours. The method should ask the user to enter the number of hours worked in each day (fill the array). • A method TotalAmount that returns the amount which should be paid by the company to the employee. If the total worked hours exceeds 150, the company should pay an additional bonus of 10% of the total amount. Thus, normal payment is calculated as = total number hours X price per hour. Whereas, for bonus, the payment is calculated as = 1.10 X total number hours X price per hour

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 2CP
icon
Related questions
Question

Write a java program: 

 

 

Write the definition of a class named Employee to hold the data of the working hours of employees and their salaries in a company. The class includes the following private data members: • Name: to represent employee's name • ID: to represent employee's ID • NumberHours: an array of type integer of size 24 to save the number of hours worked by the employee during the days of the month. • Price: to represent the price per hour. Additionally, the class should include: • A constructor that takes three parameters to initialize the instance variables Name, ID and price and create the array NumberHours. • A method SetHours. The method should ask the user to enter the number of hours worked in each day (fill the array). · A method TotalAmount that returns the amount which should be paid by the company to the employee. If the total worked hours exceeds 150, the company should pay an additional bonus of 10% of the total amount. Thus, normal payment is calculated as = total number hours X price per hour. Whereas, for bonus, the payment is calculated as = 1.10 X total number hours X price per hour

Write the definition of a class named Employee to hold the data of the working hours of employees and their salaries in a company.
The class includes the following private data members:
• Name: to represent employee's name
• ID: to represent employee's ID
• NumberHours: an array of type integer of size 24 to save the number of hours worked by the employee during the days of
the month.
• Price: to represent the price per hour.
Additionally, the class should include:
• A constructor that takes three parameters to initialize the instance variables Name, ID and price and create the array
NumberHours.
• A method SetHours. The method should ask the user to enter the number of hours worked in each day (fill the array).
• A method TotalAmount that returns the amount which should be paid by the company to the employee. If the total worked
hours exceeds 150, the company should pay an additional bonus of 10% of the total amount.
Thus, normal payment is calculated as = total number hours X price per hour.
Whereas, for bonus, the payment is calculated as = 1.10 X total number hours X price per hour
Transcribed Image Text:Write the definition of a class named Employee to hold the data of the working hours of employees and their salaries in a company. The class includes the following private data members: • Name: to represent employee's name • ID: to represent employee's ID • NumberHours: an array of type integer of size 24 to save the number of hours worked by the employee during the days of the month. • Price: to represent the price per hour. Additionally, the class should include: • A constructor that takes three parameters to initialize the instance variables Name, ID and price and create the array NumberHours. • A method SetHours. The method should ask the user to enter the number of hours worked in each day (fill the array). • A method TotalAmount that returns the amount which should be paid by the company to the employee. If the total worked hours exceeds 150, the company should pay an additional bonus of 10% of the total amount. Thus, normal payment is calculated as = total number hours X price per hour. Whereas, for bonus, the payment is calculated as = 1.10 X total number hours X price per hour
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning