Project #89218 - Assignment #7


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

    1. name –name of the salesperson (example Jill Smith)

    2. decemberSales – sales in December (example 35.67)

    3. januarySales – sales in January

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

    5. title – job title (example “Manager”)

  2. Constructors

    1. Constructor with all fields as parameters

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

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

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

    2. Constructor with only the name as a parameter

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

      2. Set the salary to $20,000

    3. 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:

    1. setDecemberSales, setJanuarySales, setSalary

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

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

    2. setTitle

      1. Allow the user to change the title

  5. Other Methods

    1. totalSales

      1. Should calculate and return the total sales.

    2. bestMonth

      1. Should return the name of the month with the highest sales.

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

    3. totalEarned

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

      2. The bonus is dependent on the total sales and the title.

      3. 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

      4. The additional bonus based on title is:

        1. An extra $2,500 for Managers



    1. printInfo

      1. This method should print out the following information:

        1. Name

        2. Title

        3. December Sales

        4. January Sales

        5. Total Sales

        6. Total Earned

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

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

      4. 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

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

    2. Ask the user for the December sales of the salesperson

    3. Ask the user for the salesperson title

    4. Create the salesperson using the specified name

    5. Change the title to the title entered by the user

    6. Change the December sales to the number entered by the user

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



    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.


Subject Computer
Due By (Pacific Time) 10/26/2015 08:00 am
Report DMCA

Chat Now!

out of 1971 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 1164 reviews

Chat Now!

out of 721 reviews

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 680 reviews
All Rights Reserved. Copyright by - Copyright Policy