RainfallTest.java - import javax.swing.JOptionPane public class RainfallTest public static void (double arrayGiven String userInputString double for int

RainfallTest.java - import javax.swing.JOptionPane public...

This preview shows page 1 out of 1 page.

import javax.swing.JOptionPane; public class RainfallTest { public static void fillArrayWithUserDetails(double[] arrayGiven ) { String userInputString; double userMonthlyRainfallFigure; for( int index = 0; index < arrayGiven.length; index++ ) { userInputString = JOptionPane.showInputDialog( "Please enter rainfall figures for the month " + ( index + 1) ); userMonthlyRainfallFigure = Double.parseDouble( userInputString ); arrayGiven[ index ] = userMonthlyRainfallFigure; } } public static void main(String[] args) { final int MONTHS_IN_A_YEAR = 12; double[] rainfallStats = new double[ MONTHS_IN_A_YEAR ];
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Spring '19
  • chang
  • Rain, public class, rainfall figures

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture