The ABC company offers its salesperson commission, based on two factors: the amount in sales, and the type of product they sell. There are two types of products, A and B. The salesperson receives 7% commission on product A if the sales is below $40,000.00, and 10% if the sales is $40,000.00 or more. A salesperson receives 5% commission on product B, if the sales is under$20,000.00 and 6.5% if the sales is $20,000.00 or more.
Create a class called Commission. The constructor of the class that accepts three parameters:
The salesperson's id
A single character representing the type of product, and
The sales amount.
Write:
A accessor method to validate the sales amount. That is, a negative amount cannot be compansated for.
A mutator method that calculates the commission amount. In writing this method use the switch statement to determine the type of product.