Answered step by step
Verified Expert Solution
Question
1 Approved Answer
During a drought, each household in a village is restricted to a certain limit of liters of water. The current water usage of each household
During a drought, each household in a village is restricted to a certain limit of liters of water. The current water usage of each household is tracked and stored in a list.
For example, the current usage for households could be represented in the following array:
the first has used liters, the second liters, etc.
Write a methodfunction to determine the remaining amount of water each household is allowed to use and returns a new list containing these figures. If a household has already reached or exceeded the limit the they are not allowed any more water. For the example above for a limit of liters, the methodfunction should return a list containing the following values.
The rd and th households have met and exceeded the limit respectively and have remaining liters available.
Rainfall Map
Rainfall monitors from the Airbender tribe take regular measurements of rainfall in an area represented by a two dimensional n x m grid and store it as a dimensional arraylist For example, consider the following x map:
When data is not available a negative value is used. In this example of the data points are negative so we ignore them.
Write the a methodfunction that takes a map and returns the average rainfall. In the example above, data points are valid and sum to for an average of units of rain the actual units are irrelevant
Instructions & Unit Testing
For the Java version, we have provided a starter file with specific method signatures. We have also provided a JUnit starter file that has several test cases already written. In addition to implementing all methods as specified, you will be required to add additional test cases to the JUnit testing suite. Specifically, you need to add at least valid test cases for each method you need to implement.
For the Python version, we have provided a starter file with specific function signatures. We have also provided a unittest starter file that has several test cases already written. In addition to implementing all function as specified, you will be required to add additional test cases to the unittest testing suite. Specifically, you need to add at least valid test cases for each function you need to implement.
can you help me the code this I cant figure this out I got the starter code for this with functions
package unl.soc;
import java.util.List;
TODO: author, date and class documentation
public class WaterUtils
TODO: documentation
@param limit
@param usage
@return
public static List getRemainingWaterdouble limit List usage
return null;
TODO: documentation
@param map
@return
public static double averageRainfalldouble map
return ;
Step 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