ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 08 May 2017 My Price 11.00

a Java program that uses an array to store data for the village of Marengo.

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.

1. Open the source code file named Householdsize.java using notepad or the editor of your choice.

2. Write the bubble sort.

3. Output the median household size in Marengo.

4. Save the source code file in the directory of your choice, and then make that directory your working directory. 

5. Compile the source code file. Householdsize.java. 

6. Execute the program with the following input, and output the household sizes: 4, 1, 2, 4, 3, 3, 2, 2, 2, 4, 5, 6. 

Basically looking for help the bubble sort code. I have written the pseudocode but having trouble getting my compiler to work properly on this. This is my second to last assignment in this class. Looking for an A to help me get the rest of the way. 

 

 

//******************************************************************************// TTILE:// FILENAME:// PREPARED FOR:// PROGRAMMER:// DEVELOPMENT DATE:// COMPILER USED:// TARGET PLATFORM://******************************************************************************import javax.swing.*;public class HouseholdSize{public static void main(String args[]){// Declare variables.final int SIZE = 300;// Maximum number of householdsizes.int householdSizes[] = new int[SIZE];// Array used to store up to300 household sizes.int x;int limit = SIZE;int householdSize = 0;String householdSizeString;int pairsToCompare;boolean switchOccurred;int temp;double sum = 0;double mean = 0;int median = 0;// Input household sizehouseholdSizeString = JOptionPane.showInputDialog("Enter householdsize or 999 to quit: ");householdSize = Integer.parseInt(householdSizeString);// This is the work done in the fillArray() methodx = 0;while(x < limit && householdSize != 999){// Place value in array.householdSizes[x] = householdSize;// Calculate total of household sizes herex++;// Get ready for next input item.householdSizeString = JOptionPane.showInputDialog("Enterhousehold size or 999 to quit: ");householdSize = Integer.parseInt(householdSizeString);}// End of input loop.// Find the mean// This is the work done in the sortArray() method// This is the work done in the displayArray() method// Print the mean// Calculate the median// Print the median

Attachments:

Answers

(11)
Status NEW Posted 08 May 2017 02:05 AM My Price 11.00

-----------

Attachments

file 1494211904-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)