Question: Part A Create a class named Salesperson. Data fields for Salesperson include an int ID number ( id ) and a double annual sales amount
Part A
Create a class named Salesperson. Data fields for Salesperson include an int ID number id and a double annual sales amount sales Methods include a blank default constructor and a constructor that requires values for both data fields, as well as get and set methods for each of the data fields.
Write an application named DemoSalesperson that declares an array of Salesperson objects named salesPeople. Set each ID number to and each sales value to Display the Salesperson objects.
An example of the program is shown below:
Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $
Part B
Copy the code from the DemoSalesperson.java file into the DemoSalespersonjava file and modify the application so each Salesperson has a successive ID number from through and a sales value that ranges from $ to $ increasing by $ for each successive Salesperson. Rename the class DemoSalesperson
An example of the program is shown below:
Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $ Salesperson has ID # and annual sales of $
Part C
Create an application called SalespersonSort that allows a user to enter values for an array of seven Salesperson objects. Offer the user the choice of displaying the objects in order by either ID number or sales value.
An example of the program is shown below:
Enter an ID number Enter a sales value Enter an ID number
Enter a sales value By which field do you want to sort? Id number or Sales I ID sales: ID sales:
info The example above does not include all of the program's input or output.
Part D
Create an application called SalespersonDatabase that allows you to store an array that acts as a database of any number of Salesperson objects up to While the user decides to continue, offer three options: to add a record to the database, to delete a record from the database, or to change a record in the database. Then proceed as follows:
If the user selects the add option, issue an error message if the database is full. Otherwise, prompt the user for an ID number. If the ID number already exists in the database, issue an error message. Otherwise, prompt the user for a sales value and add the new record to the database.
If the user selects the delete option, issue an error message if the database is empty. Otherwise, prompt the user for an ID number. If the ID number does not exist, issue an error message. Otherwise, do not access the record for any future processing.
If the user selects the change option, issue an error message if the database is empty. Otherwise, prompt the user for an ID number. If the requested record does not exist, issue an error message. Otherwise, prompt the user for a new sales value and change the sales value for the record.
After each option executes, display the updated database in ascending order by Salesperson ID number and prompt the user to select the next action.
An example of the program is shown below:
Do you want to AddDelete or Change a record or Quit A Enter salesperson ID Enter sales Current database: ID # $ Do you want to AddDelete or Change a record or Quit C Enter ID to change Enter sales Current database: ID # $ Do you want to AddDelete or Change a record or Quit D Enter ID to delete Current database: Do you want to AddDelete or Change a record or Quit Q
Task : Created the Salesperson class.
Task : The Salesperson class contains the id and sales data fields.
Task : The Salesperson class contains a blank, default constructor, and an overloaded constructor to assign the two data fields.
Task : The Salesperson class contains the setId and getId methods.
Task : The Salesperson class contains the setSales and getSales methods.
Task : Created the DemoSalesperson class.
Task : Created the DemoSalesperson class.
Task : The DemoSalesperson program displays nine Salesperson objects with incrementing ids and sales values.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
