Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Java Program to do the Following: Create superclass named Commission . Commission class has the properties employee's first name, last name, social security number,

Write Java Program to do the Following:

Create superclass named Commission.

Commission class has the properties employee's first name, last name, social security number, gross sales, and commission rate.

Declare all data members as private. Use appropriate constructors.

Create 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 subclass BaseCommission which inherit properties of Commission class. BaseCommission class has a properties basic salary. Use appropriate constructors

Create method countSalary() which calculate total salary of employee. (Total salary=basic salary+total earning).

Write Test class and ask user to enter employee's 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

After that print employ's first name, last name ,social security number, gross sales, commission rate, basic salary, total earning and total salary.

When you print information in output window display numeric value using two decimal place. For example 200.50

Please check the following sample output for exact format.

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 employee's first name: John Please enter employee's last name: Carl Please enter employee's social security number: 123456789 Please enter employee's gross sales: 2000.50 Please enter employee's commission rate: 2.5 Please enter employee's basic salary:5000.45

After getting values from user print following output on output window

employee's first name: John employee's last name: Carl employee's social security number: 123456789 employee's gross sales: $2000.50 employee's commission rate: 2.5% employee's basic salary: $5000.45 employee's total earning: $50.01 employee's total salary: $5050.46

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions