Computer
For this program you have to create two classes. The first class is the Salesperson class that has the following:
Fields (all private). These should be the only fields in the program
name –name of the salesperson (example Jill Smith)
decemberSales – sales in December (example 35.67)
januarySales – sales in January
baseSalary – The base salary (salary before the bonus, calculated in step #5)
title – job title (example “Manager”)
Constructors
Constructor with all fields as parameters
You must check that the sales and salary are valid numbers (must be zero or a positive number).
If a monthly sales figure is not valid, set it to 0.
If a salary is not valid, set it to $20,000.
Constructor with only the name as a parameter
Set the sales figures to 0 and the title to “Unknown”.
Set the salary to $20,000
Instead of writing $20,000 in the above constructors, use a named constant with an appropriate name
Get Methods – There should be a get method for each of the five fields.
Set Methods – There should be a set method for all fields except for name:
setDecemberSales, setJanuarySales, setSalary
Must check that the parameter being passed is a number as defined in step #2
If it is not valid, leave the sales figure unchanged and print an appropriate error message.
setTitle
Allow the user to change the title
Other Methods
totalSales
Should calculate and return the total sales.
bestMonth
Should return the name of the month with the highest sales.
If both months have the same sales, you may return the name of either month.
totalEarned
Should calculate and return the total amount earned by the salesperson, the base salary plus a bonus computed as described below.
The bonus is dependent on the total sales and the title.
The calculations based on the total sales are:
If the total sales is under $40,000 the salesperson gets a bonus of 2% of total sales
For higher sales that are still under $60,000, the bonus is 3% of total sales
The bonus is 5% of total sales for all others
The additional bonus based on title is:
An extra $2,500 for Managers
printInfo
This method should print out the following information:
Name
Title
December Sales
January Sales
Total Sales
Total Earned
To calculate the last two you must use the corresponding methods. (You shouldn’t create fields for calculated values like total sales or total earned.)
Print out a line at the top of the printout (before the name)
Include prompts with each piece of information printed.
The second class is a class that includes a main() method. This class should do the following (in the given order):
Create the first salesperson – (Lucy, 35000, 75000.65, 23000 base salary, Vice President)
Create the second salesperson (Tom, 12000, 3000, 10000 base salary, Manager)
Third salesperson
Ask the user for the name of the salesperson (this should allow names with more than one word)
Ask the user for the December sales of the salesperson
Ask the user for the salesperson title
Create the salesperson using the specified name
Change the title to the title entered by the user
Change the December sales to the number entered by the user
Change the January sales to 23456.78
Use the printInfo method to print out the information for each salesperson.
Print out the name and title of the salesperson that has the highest sales in December. Print either name/title in case of ties.
Print out the name of the salesperson with the lowest total earned (print either name in the case of ties).
Print out the name of the month that the second salesperson’s sales were the highest.
Run your program twice using the following data for the third salesperson:
Julie Anne, 348.25, Project Leader
Chris, 99987.6, Manager
Note.
1) Each class must have a header, which has your name, the date, the program number and program title (name).
2) Your program should work correctly for any set of data, not only the given data.

+1 862 207 3288 