CSC1350Lab07Af17-2.pdf - Laboratory Assignment № 7 Wyatt Clements CSC 1350 Louisiana State University More on Using Arrays as Explicit Parameters to

CSC1350Lab07Af17-2.pdf - Laboratory Assignment № 7 Wyatt...

This preview shows page 1 - 3 out of 5 pages.

Assignment № 7 Page 1 Laboratory Assignment № 7 Wyatt Clements, CSC 1350, Louisiana State University 11/01/2016 More on Using Arrays as Explicit Parameters to Methods The GradesRearranger In this laboratory exercise, you will write a program that rearranges a collection of test scores so that they are in non-descending order. Assume that the collection consists of integers in the range 0 to 100. Some of the subtasks of the program will be performed in methods other than the main. The program will consist of only one class, GradesRearranger, that consists of 10 static integer arrays of length 101 and four static methods, including the main method. The static arrays will have class scope and be allocated in the class. Preliminary Version This version of the program will consist of the following: A. Declare and instantiate 10 private static integer arrays, each of which can store 101 integers. Name the arrays bin0 , bin1 , ··· , bin9 . B. Define the method below in the class: /** * Gives a reference to the bin whose numeric suffix * corresponds to the specified number. * @param binNum the number suffix of a bin * @return a reference to the bin with the specified * numeric suffix. */ public static int[] selectBin(int binNum)
Image of page 1
Assignment № 7 Page 2 C. Define the method below in the class: /** * Scans the specified array from left to right, data[0] to * data[n-1], where n is the length of the array, and places * each element in the bin that corresponds to its digit in * the specified place by first increasing the effective size * of the array by 1 and then copying the element at the index * equals to the new effective size of the bin. The effective * size of a bin, the number of useful data elements that it * contains, is stored as the first element of the bin. For * example, when the data element is 98 and the place is 1, * 98 is inserted in bin8; when the place is 10, it is inserted * in bin9; when the place is 100, it is inserted in bin0. * @param data an array of integers in the range 0...100 * @param place the place of the digit in the data that * determines which bin it will be inserted in; place = 1 * (units) place, 10 (tens), 100 (hundreds) place etc. It * must be a power of 10.
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 5 pages?

  • Spring '08
  • Blanks

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors