Question: This is a computer science II Java coding question- please read the instructions and use the pre-written code below to complete the program and get
This is a computer science II Java coding question- please read the instructions and use the pre-written code below to complete the program and get the correct output.

Using a Bubble Sort in Java m E Using a Bubble Sort Summary In this lab, you complete a Java program that uses an array to store data for the village of Marengo. 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. Instructions HouseholdSize.java 1 // HouseholdSize.java - This program uses a bubble sort to arrange up to 300 household sizes in 2 // descending order and then prints the mean and median household size. 3 // Input: Interactive. 4 // Output: Mean and median household size. 5 6 import java.util.Scanner; 7 8 public class HouseholdSize 9 { 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 public static void main(String args[]). { Scanner s = new Scanner(System.in); // Declare variables. final int SIZE = 300; // Maximum number of household sizes. int householdSizes[] = new int[SIZE]; // Array used to store up to 300 household sizes. int x; int limit= SIZE; int householdSize = 0; String householdSizeString; int pairsToCompare; lean int temp; double sum = 0; double mean = 0; double median = 0; urred; // Input household size
Step by Step Solution
3.36 Rating (159 Votes )
There are 3 Steps involved in it
HouseholdSizejava import javautilScanner public class HouseholdSize public static vo... View full answer
Get step-by-step solutions from verified subject matter experts
