Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA /** * This method adds rainfall values to the array. Using a while loop * - present the message, e.g. Please enter an integer

JAVA

/** * This method adds rainfall values to the array. Using a while loop * - present the message, e.g. "Please enter an integer for the rainfall data for January or enter x to stop" * - get the input from the console, if it is "x" then the loop stops and false is returned. Otherwise store the integer value in the array * - end the loop when 12 integers have been added to the array, return true. * * @return true if a value was given for all 12 months, return false use enter x to stop */ public static boolean addRainfallData() { String [] months= {"january", "march"}; Scanner scan = new Scanner(System.in); int i=1; while(i<=12) { System.out.println("Please enter an integer for the rainfall data for " + months[0] + " or enter x to stop:"); int num=scan.nextInt(); i++; } return false; }

}

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

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

ISBN: ? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago