JAVA ASSIGNMENT

  1. Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a double annual sales amount. Methods include 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 10 Salesperson objects. Set each ID number to 9999 and each sales value to zero. Display the 10 Salesperson objects. Save the files as Salesperson.java and DemoSalesperson.java.

 

  1. Modify the DemoSalesperson application so each Salesperson has a successive ID number from 111 through 120 and a sales value that ranges from $25,000 to $70,000, increasing by $5,000 for each successive Salesperson. Save the file as DemoSalesperson2.java.

 

 

 

Output of DemoSalesperson

 

Salesperson 0 has ID #9999 and annual sales of $.00

Salesperson 1 has ID #9999 and annual sales of $.00

Salesperson 2 has ID #9999 and annual sales of $.00

Salesperson 3 has ID #9999 and annual sales of $.00

Salesperson 4 has ID #9999 and annual sales of $.00

Salesperson 5 has ID #9999 and annual sales of $.00

Salesperson 6 has ID #9999 and annual sales of $.00

Salesperson 7 has ID #9999 and annual sales of $.00

Salesperson 8 has ID #9999 and annual sales of $.00

Salesperson 9 has ID #9999 and annual sales of $.00

 

Output of DemoSalesperson2

 

Salesperson 0 has ID #111 and annual sales of $25,000.00

Salesperson 1 has ID #112 and annual sales of $30,000.00

Salesperson 2 has ID #113 and annual sales of $35,000.00

Salesperson 3 has ID #114 and annual sales of $40,000.00

Salesperson 4 has ID #115 and annual sales of $45,000.00

Salesperson 5 has ID #116 and annual sales of $50,000.00

Salesperson 6 has ID #117 and annual sales of $55,000.00

Salesperson 7 has ID #118 and annual sales of $60,000.00

Salesperson 8 has ID #119 and annual sales of $65,000.00

Salesperson 9 has ID #120 and annual sales of $70,000.00

 

 

 

 

2-

 

  1. Create a FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating, and the date. The class includes methods to get each field. In addition, create a default constructor that automatically sets the activity to running, the minutes to 0, and the date to January 1 of the current year. Save the file as FitnessTracker.java. Create an

application that demonstrates each method works correctly, and save it as TestFitnessTracker.java.

 

  1. Create an additional overloaded constructor for the FitnessTracker class

you created in Exercise 3a. This constructor receives parameters for each of

the data fields and assigns them appropriately. Add any needed statements

to the TestFitnessTracker application to ensure that the overloaded

constructor works correctly, save it, and then test it.

 


    Make your order right away

    Confidentiality and privacy guaranteed

    satisfaction guaranteed