Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, can anyone assist me with my Java assignment? Thanks in advance You will be given the name of a city followed by a set
Hello, can anyone assist me with my Java assignment? Thanks in advance
You will be given the name of a city followed by a set of integers representing the monthly rainfall (in millimeters) that have happened in a given area over the past year. You will then calculate the average (mean) rainfall for the year. The mean is calculated by dividing the sum of the values in the set by the number of elements in the set. mean of a set = sum of all elements / number of elements The mean of the series 1, 2, 3, 4, 5 is: 1+2+3+4+5/5 = 15/5= 3 Output will be of the form "The average rainfall in city is mean mm" Write the body of the program. Function Details Input The program reads in the following: A string, the name of a city Twelve integers, representing the monthly rainfall (in millimeters) for the given city over the past year Processing You will calculate the mean rainfall. You will calculate the mean rainfall. Output Output the following where city is replaced by the name of the city and mean is replaced by the calculated average (integer) rainfall: The average rainfall in city is mean mm The text must be terminated by a new-line character. Sample input/output: Sample Input Sample Output Halifax 96 69 97 98 111 108 107 97 100 125 129 118 The average rainfall in Halifax is 105 mm 6 import java.util.*; public class PoD { public static void main(String[] args) { 11 //PLEASE START YOUR WORK HERE - 13 15 16 17 //PLEASE END YOUR WORK HERE System.out.print("END OF OUTPUT"); } 18 19 }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