Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hi my code will not run. I'm confused on why can you help me fix it? here was the task list. Task 1: The system

hi my code will not run. I'm confused on why can you help me fix it?

here was the task list.

  • Task 1: The system will ask the user to enter an integer for each of the twelve months in order, with a message that lets the user know the name of the month that the data is for. If the user wishes to cancel this input process, they can enter "x" instead of an integer. Complete the method public static boolean addRainfallData to complete this task. See the method comments for more detail.
  • Task 2: The system will compute and return the average rainfall. Complete the method public static double averageRainfall to complete this task. See the method comments for more detail.
  • Task 3: The system will determine and return the numeric value of the lowest rainfall of the twelve collected. Complete the method public static int lowestRainfallAmount to complete this task. See the method comments for more detail.
  • Task 4: The system will determine and return the name of the month with the lowest rainfall of the twelve collected. Complete the method public static String lowestRainfallMonth to complete this task. See the method comments for more detail.
  • Task 5: The system will determine and return the numeric value of the highest rainfall of the twelve collected. Complete the method public static int highestRainfallAmount to complete this task. See the method comments for more detail.
  • Task 6: The system will determine and return the name of the month with the highest rainfall of the twelve collected. Complete the method public static String highestRainfallMonth to complete this task. See the method comments for more detail.

image text in transcribed

package assignment: import java.util.Scanner public class RainfallTracker public class main ! public static int I) data new int(12): public static String() months = new String). January","February", "March","April", "May","June","July", "August", September", "October", "Nuvetber", "December"); public static void collares { adaraintal Loatal), System.out.println("The average rainfall for the year was "+averageRainfall()+" inches."); //answersi datal:8.5, data2:6.5, data3:11.91666.... System.out.println("The lowest rainfall recorded for any nonth was "lowestRainfallAmount( inches");//answersi datal:1, data2:1, data3:8 System.out.println("The name of the unth with the lowest recorded rainfall was "+lowest Rainfat Month}); //answers: datai: January System.out.printlnt"The highest rainfall recorded for any month was "thighest Rainfall Aount()+" inches");//answers: datai:12, data 2:12, data3:30 dat 2:December, datu 3: April Systen.out.println("The name of the month with the highest recorded rainfall was "thighest RaintaiMonth();//answers: data1: December, data: January, data3: June } public static double averageRainfall! { double sun = for(int i=8; icdata. length; i++) {sutudatalil; } return (sut/data.length); } public static int lowest RainfallArount() { int nin_rain = data) for(int i=1; isdata.length; i++) { if(data[i] ) return nin_rain; : } public static String luwestRainfallMonthl { int nilrain = data[0]; String nin_month - wonths tel; fortint i-T; i data.length; i++) { (data[1]nax_rain) max_ruin = datafil max month - nonchlil; } } return nax_month; } public static boolean addRainfalldata) { [ Scanner Acer = new Scanner(System.in); System.out.print(" "); int idx = 8; while idxc12) { System.out.print("Please enter an integer for the rainfall data far wonths (idx)." or enter x to stop: "); String val = scanner.nextLine(); if(val.equalsi"x")) { return false; } else { datalidx) - Toteger.parseIntve1): ) 1dx 1; } return true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions