//tested on Eclipse /*************Rainfall.java*************/ import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class RainFall { /*Data member variable*/ private double monthlyRainFall; private double monthsRainFall[]=new double[12]; private int month=0; private double maxRain=0.0; private int maxrainMonth; private double minRain=0.0; private int minRainMonth; /*creating map for storing month*/ Map monthMap=new HashMap(); Scanner input=new Scanner(System.in); /*Initializing map with value while default constructor*/ public RainFall(){ monthMap.put(0, \"January\"); monthMap.put(1, \"February\"); monthMap.put(2, \"March\"); monthMap.put(3, \"April\"); monthMap.put(4, \"May\"); monthMap.put(5, \"June\"); monthMap.put(6, \"July\"); monthMap.put(7, \"August\"); monthMap.put(8, \"September\"); monthMap.put(9, \"October\"); monthMap.put(10, \"November\"); monthMap.put(11, \"December\"); } /*Getting monthlyRainFall*/ public double getMonthlyRainFall() { return monthlyRainFall; } /*Setting monthly rainfall If it is negative then it loops until positive */ public void setMonthlyRainFall(double monthlyRainFall) { while(monthlyRainFall<0){ System.out.println(\"Please Enter positive value of monthly rainfall\"); monthlyRainFall=input.nextDouble(); } monthsRainFall[month++]=monthlyRainFall; } /*Getting average month rain fall*/ public void averageMonthlyRainFall(){ double totalRainFall=0; /*first calculate totalRain fall after that divide it total month*/ for(int i=0;imonthsRainFall[i]){ minRain=monthsRainFall[i]; minRainMonth=i; } } System.out.println(\"Min Rain Month Fall: \"+monthMap.get(minRainMonth)); } /*Main method start*/ public static void main(String[] args) { Scanner sc=new Scanner(System.in); /*Creating instance of rainFall class*/ RainFall rainFall=new RainFall(); /*getting rainfall for each month from user*/ for(int i=0;i<12;i++){ System.out.println(\"Please Enter rainFall for \"+(i+1)+\" Month\"); rainFall.setMonthlyRainFall(sc.nextDouble()); } /*Average Monthly rainfall*/ rainFall.averageMonthlyRainFall(); /*Total Rain Fall in a year*/ rainFall.totalRainFall(); /*Max rainFall Month*/ rainFall.maxRainFallMonth(); /*Minimum rainFall Month*/ rainFall.minRainFallMonth(); sc.close(); } } /***************output************/ Please Enter rainFall for 1 Month 121 Please Enter rainFall for 2 Month 134 Please Enter rainFall for 3 Month 54 Please Enter rainFall for 4 Month 167 Please Enter rainFall for 5 Month 256 Please Enter rainFall for 6 Month 456 Please Enter rainFall for 7 Month 78 Please Enter rainFall for 8 Month 290 Please Enter rainFall for 9 Month 176 Please Enter rainFall for 10 Month 263 Please Enter rainFall for 11 Month 100 Please Enter rainFall for 12 Month 189 Average Monthly Rain Fall: 190.33 Total Rain Fall for the year: 2284 Max Rain Month Fall: June Min Rain Month Fall: March Thanks a lot. If you have any doubt. Please let me know Solution //tested on Eclipse /********.