Posted: November 9th, 2015

Computer

Computer

For this program you have to create two classes. The first class is the Salesperson class that has the following:

1)      Fields (all private). These should be the only fields in the program

a)      name –name of the salesperson (example Jill Smith)

b)      decemberSales – sales in December (example 35.67)

c)      januarySales – sales in January

d)      baseSalary – The base salary (salary before the bonus, calculated in step #5)

e)      title – job title (example “Manager”)

2)      Constructors

a)      Constructor with all fields as parameters

i)        You must check that the sales and salary are valid numbers (must be zero or a positive number).

ii)      If a monthly sales figure is not valid, set it to 0.

iii)    If a salary is not valid, set it to $20,000.

b)      Constructor with only the name as a parameter

i)        Set the sales figures to 0 and the title to “Unknown”.

ii)      Set the salary to $20,000

c)      Instead of writing $20,000 in the above constructors, use a named constant with an appropriate name

3)      Get Methods – There should be a get method for each of the five fields.

4)      Set Methods – There should be a set method for all fields except for name:

a)      setDecemberSales, setJanuarySales, setSalary

i)        Must check that the parameter being passed is a number as defined in step #2

ii)      If it is not valid, leave the sales figure unchanged and print an appropriate error message.

b)      setTitle

i)        Allow the user to change the title

5)      Other Methods

a)      totalSales

i)        Should calculate and return the total sales.

b)      bestMonth

i)        Should return the name of the month with the highest sales.

ii)      If both months have the same sales, you may return the name of either month.

c)      totalEarned

i)        Should calculate and return the total amount earned by the salesperson, the base salary plus a bonus computed as described below.

ii)      The bonus is dependent on the total sales and the title.

iii)    The calculations based on the total sales are:

(1)   If the total sales is under $40,000 the salesperson gets a bonus of 2% of total sales

(2)   For higher sales that are still under $60,000, the bonus is 3% of total sales

(3)   The bonus is 5% of total sales for all others

iv)    The additional bonus based on title is:

(1)   An extra $2,500 for Managers

d)      printInfo

i)        This method should print out the following information:

(1)   Name

(2)   Title

(3)   December Sales

(4)   January Sales

(5)   Total Sales

(6)   Total Earned

ii)      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.)

iii)    Print out a line at the top of the printout (before the name)

iv)    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):

1)      Create the first salesperson – (Lucy, 35000, 75000.65, 23000 base salary, Vice President)

2)      Create the second salesperson (Tom, 12000, 3000, 10000 base salary, Manager)

3)      Third salesperson

a)      Ask the user for the name of the salesperson (this should allow names with more than one word)

b)      Ask the user for the December sales of the salesperson

c)      Ask the user for the salesperson title

d)      Create the salesperson using the specified name

e)      Change the title to the title entered by the user

f)       Change the December sales to the number entered by the user

g)      Change the January sales to 23456.78

4)      Use the printInfo method to print out the information for each salesperson.

5)      Print out the name and title of the salesperson that has the highest sales in December. Print either name/title in case of ties.

6)      Print out the name of the salesperson with the lowest total earned (print either name in the case of ties).

7)      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:

1)      Julie Anne, 348.25, Project Leader

2)      Chris,  99987.6, Manager

PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET A GOOD DISCOUNT 🙂

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Live Chat+1-631-333-0101EmailWhatsApp