Question
Commission class has the properties employees first name, last name, social security number, gross sales, and commission rate. Declare all data members as private. Use
Commission class has the properties employees first name, last name, social security number, gross sales, and commission rate.
Declare all data members as private. Use appropriate constructors.
Create a method earning() which calculate total earning. (Total earning=gross sales* commission rate).
Note that commission rate is a percentage, e.g., like 4.5%. You need to divide it by 100
Create a subclass BaseCommission which inherit properties of Commission class.
BaseCommission class has a properties basic salary. Use appropriate constructors
Create a method countSalary() which calculate total salary of employee. (Total salary=basic salary+total earning).
Write a Test class and ask user to enter employees first name, last name, social security number, gross sales, commission rate and basic salary
After getting values from user create object of BaseCommission class and pass appropriate values as argument to the BaseCommision constructor
Use toString() method to print employs first name, last name ,social security number, gross sales, commission rate, basic salary, total earning and total salary.
following values you are asking user to enter through console using scanner class
Sample output: this is sample value, you can enter any value to check your answer
Please enter employees first name: John
Please enter employees last name: Carl
Please enter employees social security number: 123456789
Please enter employees gross sales: 2000.50
Please enter employees commission rate: 2.5
Please enter employees basic salary:5000.45
After getting values from user print following output on output window
employees first name: John
employees last name: Carl
employees social security number: 123456789
employees gross sales: $2000.50
employees commission rate: 2.5%
employees basic salary: $5000.45
employees total earning: $50.01
employees total salary: $5050.46
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started