Write a static method called updateEmpCommission() to receive the array and update the commission of some of the employees as follows: Use a loop to update a number of employees' commission. Use a sentinel value -1 to control the loop.  Display the list of employees.  Ask the user to enter a number from the list.  If the number is not -1, then enter a sales amount.  Call the updateComm() method to update the commission of the employee. If the user enters -1 instead of a number from the list

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

.

Create a testEmployees class.  Do the following:

  • Declare an array called arrEmp of 10 Employee type objects in the main method. 
  • Write a static method called fillArray() that receives the arrEmp array.  Use a while loop to enter the information (type of contract) of a number of new employees.  Quit input by entering the character X instead of the type of contract.  For each employee create an object and save the object in the array.  Return the array to the main method. 
  • Call the static fillArray() method from the main method. 

 

  • Write a static method called displayArray() to receive the array and display a numbered list of the information of the employees using a for-loop and the toString() method. 
  • Call the static displayArray() method from the main method. 

 

  • Write a static method called updateEmpCommission() to receive the array and update the commission of some of the employees as follows:
    • Use a loop to update a number of employees' commission.
    • Use a sentinel value -1 to control the loop. 
    • Display the list of employees. 
    • Ask the user to enter a number from the list.  If the number is not -1, then enter a sales amount. 
    • Call the updateComm() method to update the commission of the employee.
    • If the user enters -1 instead of a number from the list, the loop must be terminated. 
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,