subject

Java program with comments in main and in each method. A city is divided into 100 neighborhoods, each with a unique name. Every three months, each neighborhood reports the prices of four houses sold; not all neighborhoods have sales to report every three months. A file contains the sales data in the format:
neighborhood price price price price
For example, Midtown 23055 10000 19000 32009 (Note: prices are in whole dollars)
Design a Java class with a main method that does the following:
Invokes method readData which reads the data from the input file, stores values into arrays and returns the number of records read in.
Invokes method modifyData, passing an array of double as the parameter. The method modifies the value in the array based on rules specified below.
Invokes method sortArrays to parallel sort the arrays of double and String. The method should be invoked only once.
Prints to a file the neighborhood name and average of the three neighborhoods that have the highest average prices, in descending order (highest average price first), and the three neighborhoods that have the lowest average prices in ascending order (lowest average price first). The neighborhood should be left adjusted, the price right adjusted with two decimal places and the header row should be included. The output should be in the form:
Neighborhood Avg Price
Eastside 108162.50
Greenfields 67576.06
Southside 60967.78
Neighborhood Avg Price
Chelsea 47663.28
Westside 48830.93
Uptown 57200.00
Method Details:
1. readData:
2. Receives an array of String and array of double
3. Reads the neighborhood name as String and the four prices as integer from a file (name of your choice)
4. Stores the neighborhood name in the array of String and the average of the 4 prices in the array of double.
5. Returns the number of neighborhood records read in as an integer
6. modifyData:
7. Receives an array of double as the parameter and an integer representing the number of records read in by readData
8. Computes the overall average home price for all homes read in by readData (the average of the averages)
9. For the number of records read in from the input file, increases the average price for each neighborhood by 10% if the average home price for that neighborhood is below the overall average home price homes sold and decreases the average price for each neighborhood by 15% if the average home price for that neighborhood is above the overall average.
10. sortArrays:
11. Receives the arrays of double and String and an integer representing the number of records read in by readData as parameters
12. Parallel sorts the arrays, only for the number of records read in by readData, with the primary sort on the array of double in descending order.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:30, samone26
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. purchases at stock exchanges--what’s being bought-- are one source of data with a natural ordering in time. given a long sequence s of such events, your friends want an efficient way to detect certain "patterns" in them--for example, they may want to know if the four events buy yahoo, buy ebay, buy yahoo, buy oracle occur in this sequence s, in order but not necessarily consecutively. they begin with a collection of possible events (e. g., the possible’ transactions) and a sequence s of n of these events. a given event may occur multiple times in s (e. g., yahoo stock may be bought many times in a single sequence s). we will say that a sequence s’ is a subsequence of s if there is a way to delete certain of the events from s so that the remaining events, in order, are equal to the sequence s’. so, for example, the sequence of four events above is a subsequence of the sequence buy amazon, buy yahoo, buy ebay, buy yahoo, buy yahoo, buy oracle their goal is to be able to dream up short sequences and quickly detect whether they are subsequences of s. so this is the problem they pose to you: give an algorithm that takes two sequences of even~s--s’ of length m and s of length n, each possibly containing an event more than once--and decides in time o(m n) whether s’ is a subsequence of s
Answers: 2
image
Computers and Technology, 22.06.2019 18:30, leannhb3162
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
image
Computers and Technology, 22.06.2019 20:30, fickllyd000
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
image
Computers and Technology, 23.06.2019 01:30, anggar20
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
You know the right answer?
Java program with comments in main and in each method. A city is divided into 100 neighborhoods, ea...

Questions in other subjects:

Konu
Chemistry, 06.11.2020 02:50