Starting from:

$30

CPT120-Tutorial 5 Salary Processor Solved

1. Implement code in the Modules→Week 5→Arrays lesson PDF named ‘full program demonstrating the basics’  in a new Eclipse project, rename it as SalaryProcessor and get it to work. Now modify it so that the array size (originally 3) is taken as a user input. You must use a while loop to ensure that only integers that can be used for creating an array are accepted (see while loop lesson on indefinite looping). Afterwards, using a while loop, take inputs and assign values to each array position. Optional: You can make relevant changes to use JOptionPane instead of System.out…

5.2. Modify the code from exercise 5.1 so that job names are also stored in an array of a data type suitable for storing names. E.g. job names array element 0 would correspond with the salary array element 0, then 1 with 1, etc. What is a good name for this array? Why? When displaying a salary at any point, display also the job name that corresponds with that salary.

5.3. [This is an investigative learning exercise. If you are unable to complete any part, you must detail the research that you did to demonstrate effort] Modify the code from the previous step to calculate the total and the average of all salaries. Finally, for each salary, display by how much it is different from the average salary. Note: Even if you are unable to complete this, you must follow your instructor’s demonstration when shown during the weekly compulsory chat lesson.

5.4.  A sorting algorithm re-arranges values in an array in either the ascending or the descending order. Select the “Play All” button on the Sorting Algorithms Animations page to see how different sorting algorithms (columns) sort data in various starting orders (rows). Read the description of a sorting algorithm and implement it in your application to sort the salaries in either ascending or descending order.


More products