CPT120 Tutorial 5 Solved

25.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product
  1. Follow the materials under Canvas→Modules→Week 5
For these exercises, you are expected to show your work that is in progress and ask questions from your group tutors via Canvas→Discussion forums as needed. Please note that tutors are not able to give answers before the deadline or conduct one-on-one tutoring via email or direct messaging as these are not equitable practices. When posting code, please replicate any errors or issues in isolation rather than putting the whole code up there and asking others to fix it; doing the former will also help you abstract the problem as well.

5.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. [Optional to submit but must follow when solution shown] 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.

Note: You will not be quizzed on sorting algorithms but they are a good demonstration of how arrays can be used.

5.5. Add comments in the style required by Assignment 2. See rubric in section 9 of the Assignment 2 PDF.

5.6. [Optional to submit but must follow when solution shown] How can we resize an array (without using ArrayLists)?

6. If you have not submitted your final version of A2, add comments explaining your plan. Note that this will not be marked but it is to help you progress.
  • Independent_Investigation_Effort_05-sah3vi.zip