Question: java code Assume each city is located in an integer - pair ( x , y ) valued location within a 2 5 x 2
java code
Assume each city is located in an integerpair x y valued location
within a x square mile area. For example, a city can be located at
but not at In other words, there are no real valued
coordinate for a location of a city.
Your program will consider each integerpair valued location within the area
as a possible site for the nuclear plant, starting at and continuing
across each row until the final site is reached.
At each possible location for the nuclear plant, your program will compute
the average unhappiness if the plant were located there. The following two
rules will be used to compute the unhappiness for a city.
If the plant is within two miles or less of a city, the
unhappiness is infinite that is assign a very large number
to the unhappiness for that city
Otherwise, the unhappiness is equal to the population of the
city divided by the distance of the plant from the city.
The average unhappiness equals:
Avg. Unhappiness Sum of the unhappiness of cities
The total state's population.
Your program should select the site at which the average unhappiness is
smallest.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
