Question: Marbles Rearranger - java language LABORATORY ASSIGNMENT Ne 7 Dr. Duncan, CSC 1350, Louisiana State University 1102/2017 More on Using Arrays as Explicit Parameters to

Marbles Rearranger - java language  Marbles Rearranger - java language LABORATORY ASSIGNMENT Ne 7 Dr. Duncan,
CSC 1350, Louisiana State University 1102/2017 More on Using Arrays as Explicit
Parameters to Methods The MarblesRearranger In this laboratory exercise, you wil wrhe
a program hat simulates the rearrangemert of a col ection of marbles

LABORATORY ASSIGNMENT Ne 7 Dr. Duncan, CSC 1350, Louisiana State University 1102/2017 More on Using Arrays as Explicit Parameters to Methods The MarblesRearranger In this laboratory exercise, you wil wrhe a program hat simulates the rearrangemert of a col ection of marbles in two colors. Assume that the colection consists of black and white males The collection of marbles will be represented by an integer amay of zeros and ones, where denotes a black marble and 1 denotes a white marble. Some of the subtasks of the program will be peromed in methods other than the main The program will consist of only one class MarbleReananger, that consists of four methods including the main method Preliminay Version This version of the program will consist of the tollowing A Define the method below in the class: e Gives the index of the first, left-most, white marble @param marbles an array of o's and 1.s denoting black and white marbles, respectively @return the index of the left-most white (1) marble public static int getFirstwhiteIndex(int) marbles) B. Deline the method below in the class eDetermines the index of next left-most black marble (O) to the right of the index from or the nunber of marbles (length of the array) if there is none @param marbles an array of 0.s and 1.s denoting black and white narbles, respectively . epar an fron the index of a white marble e ereturn the index of the next left-most black marble public static int getNextBlackIndex (int[] marbles, int fron Assignment 7 Page 1 C Deline the main method so that it does the tolowing: (a) Creates an integer amay firstBnonaties oorsising at [1,0, 1, 0, 1,0,0,0,1, (b) Using the getFirstwhiteindex methed, display the index of the first white marble with an appropriate label (c) Using the getNextBlackindex method, display the index ofthe lef-most black marble to the right of the first white marble, wih an approprate label (d) Creates another array consistingof[0.0.0.a 1, 1, 1, 1,0. LABORATORY ASSIGNMENT Ne 7 Dr. Duncan, CSC 1350, Louisiana State University 1102/2017 More on Using Arrays as Explicit Parameters to Methods The MarblesRearranger In this laboratory exercise, you wil wrhe a program hat simulates the rearrangemert of a col ection of marbles in two colors. Assume that the colection consists of black and white males The collection of marbles will be represented by an integer amay of zeros and ones, where denotes a black marble and 1 denotes a white marble. Some of the subtasks of the program will be peromed in methods other than the main The program will consist of only one class MarbleReananger, that consists of four methods including the main method Preliminay Version This version of the program will consist of the tollowing A Define the method below in the class: e Gives the index of the first, left-most, white marble @param marbles an array of o's and 1.s denoting black and white marbles, respectively @return the index of the left-most white (1) marble public static int getFirstwhiteIndex(int) marbles) B. Deline the method below in the class eDetermines the index of next left-most black marble (O) to the right of the index from or the nunber of marbles (length of the array) if there is none @param marbles an array of 0.s and 1.s denoting black and white narbles, respectively . epar an fron the index of a white marble e ereturn the index of the next left-most black marble public static int getNextBlackIndex (int[] marbles, int fron Assignment 7 Page 1 C Deline the main method so that it does the tolowing: (a) Creates an integer amay firstBnonaties oorsising at [1,0, 1, 0, 1,0,0,0,1, (b) Using the getFirstwhiteindex methed, display the index of the first white marble with an appropriate label (c) Using the getNextBlackindex method, display the index ofthe lef-most black marble to the right of the first white marble, wih an approprate label (d) Creates another array consistingof[0.0.0.a 1, 1, 1, 1,0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!