Question
The Seattle City Council has decided to prioritize its spending on street maintenance according to the ages of the people who live in the street.
The Seattle City Council has decided to prioritize its spending on street maintenance according to the ages of the people who live in the street. Streets with older people will get extra funding, and homes with older people will get more attention in the street.
In order to implement this policy a computer program is needed. The first part of the program has to:
Store the house number for each house in the street.
For each house, store the age of each person who lives in the house.
Once the data has been stored some basic analysis is required:
Report the total age of the people in each house.
Report the total age of the people in the street.
Here what a sample run should look like (with the keyboard input shown in italics) ..
How many houses in the street? : 4 What is the next house number? : 100 What is the next house number? : 30 What is the next house number? : 405 What is the next house number? : 670 How many people live in number 100 : 4 What is the age of person 1 : 32 What is the age of person 2 : 28 What is the age of person 3 : 12 What is the age of person 4 : 8 How many people live in number 30 : 1 What is the age of person 1 : 84 How many people live in number 405 : 5 What is the age of person 1 : 78 What is the age of person 2 : 45 What is the age of person 3 : 23 What is the age of person 4 : 12 What is the age of person 5 : 10 How many people live in number 670 : 2 What is the age of person 1 : 22 What is the age of person 2 : 17 House 100 has a total age of 80 House 30 has a total age of 84 House 405 has a total age of 168 House 670 has a total age of 39 The street has a total age of 371
Implement the program in Java. It would be best if you have separate methods for inputing the data and analysing the data, but doing the whole thing in the main method is tolerable (only because the data structure stuff is quite tricky). Use an array to store the house numbers (0.5%) Build an irregular two dimensional array data structure to store the people's ages (1.5%). Analyse the data structure to extract the required information (1.0%). The example above would create the following array structures, please note that the house numbers are 100,30,405, and 670:
Please That is a Java programing. Thanks.
houseNumbers 4 6 house Ages 32 28 12 84 45 23 12 10 78 17Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started