Using a Bubble Sort
In this lab, you will complete a Java program that uses an array to store data for the village of Marengo. The village of Marengo conducted a census and collected records that contain household data, including the number of occupants in each household. The exact number of household records has not yet been determined, but you know that Marengo has fewer than 300 households. The program is described in Chapter 8, Exercise 5, in Programming Logic and Design. The program should allow the user to enter each household size and determine the mean and median household size in Marengo. The program should output the mean and median household size in Marengo. The file provided for this lab contains the necessary variable declarations and input statements. You need to write the code that sorts the household sizes in ascending order using a bubble sort, and then prints the mean and median household size in Marengo. Comments in the code tell you where to write your statements.
1. Open the source code file named HouseholdSize.java using Notepad or the text editor of your choice.
2. Write the bubble sort.
3. Output the mean and median household size in Marengo.
4. Save this source code file in a directory of your choice, and then make that directory your working directory.
5. Compile the source code file, liouseholdSize.java.
6. Execute the program with the following input, and record the output.
Household sizes: 4, 1, 2, 4, 3, 3, 2, 2, 2, 4, 5, 6
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.