This Problem Set Is Due By 11:59 PM on November 17, 2013

  1. Sales Person (20 points)

    Design and develop a class that represents a sales person. This class should have the following attributes:

    • NO_NAME - A private constant String set to "No Name"
    • name - A private String containing the name of the sales person
    • itemsForSale - a private ObjectArray.
    • currentItem - a private int indicating the index of the current item.

    Your class should have the following public methods and constructors:

    • SalesPerson() - Initializes the name to NO_NAME and initializes the itemsForSale array to its default size and currentItem to -1.
    • SalesPerson(String newName) - Initializes the name to newName and initializes the itemsForSale to its defaul size and currentItem to -1.
    • addItemForSale(ItemSales item) - This method adds the given item to the itemsForSale array.
    • addItemsForSale(ItemSales[] items) - This method adds the ItemSales items contained in the items array to the itemsForSale array.
    • getNumberOfItemsForSale() - This method returns the number of items int the itemsForSale array.
    • getFirstItemForSale() - This method returns the first ItemSales item from the itemSales array and initizes the currentItem counter. If the array is empty, this method returns a null.
    • getNextItemForSale() - This method returns the next ItemSales item from the itemSales array and updates the currentItem counter. If the there are no more ItemSales items in the array, this method returns a null.
    • getAllItemsForSale() - This method returns a copy of itemsForSale.
    • getTotalSales() - This method returns the total sales for this sales person.
    • getTotalDiscounts() - This method returns the total discounts that this sales person provided to their customers.
    • getName() & setName(String newName) methods for the name attribute.

    Name this class SalesPerson
    Place this class in the edu.cuny.lehman.cmp326.sales package.

  2. Sales Force (20 points)

    Design and develop a class that represents a sales force. This class should have the following attributes:

    • salesPeople - a private ObjectArray.
    • currentSalesPerson - a private int indicating the index of the current sales person.

    Your class should have the following public methods and constructors:

    • SalesForce() - Initializes the salesPeople array to its default size.
    • addSalesPerson(SalesPerson person) - This method adds the given person to the salesPeople array.
    • getNumberOfSalesPeople() - This method returns the number of items int the itemsForSale array.
    • getFirstSalesPerson() - This method returns the first SalesPerson from the salesPeople array and initizes the currentSalesPerson counter. If the array is empty, this method returns a null.
    • getNextSalesPerson() - This method returns the next SalesPerson from the salesPeople array and updates the currentSalesPerson counter. If the there are no more SalesPerson items in the array, this method returns a null. This method should also return null if the getFirstSalesPerson() method has not been called.
    • getAllSalesPeople() - This method returns a copy of salesPeople.
    • getTotalSales() - Calculate and return the total sales figure for all sales people.
    • getTotalDiscounts() - Calculate and return the total discounts figure for all sales people.
    • getAverageSales() - Calculate and return the average sales figure for all sales people.
    • getAverageDiscounts() - Calculate and return the average sales figure for all sales people.
    • displayAllSales() - This method will display the name of each SalesPerson in the sales force, followed by their total sales, total discounts, and whether they are above average, average or below average in their total sales.

    Name this class SalesForce.
    Place this class in the edu.cuny.lehman.cmp326.sales package.

Please submit the completed assignment on Blackboard by attaching all your .java files. Make sure to attach all your programs to each submission.