cREATE Java program w. nested loops intended to collect data to get avg rainfall over period of yrs. Program asks user for # of yrs. The outer loop should iterate 1x for each yr. inner loop will iterate 12 x, 1x per mo. Each iteration of the inner loop should ask a user for how many inches of rainfall were in that mo. At the end of it all, display num of mos, total inch. rainfalland avg. rainfall per mo. per year for period. DO-WHILE-LOOP used for input validate No numbers accepted can be less than 1 for # yrs. No neg numbers accepted for mo. rainfall Thank you
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
cREATE Java program w. nested loops intended to collect data to get avg rainfall over period of yrs. Program asks user for # of yrs. The outer loop should iterate 1x for each yr.
inner loop will iterate 12 x, 1x per mo. Each iteration of the inner loop should ask a user for how many inches of rainfall were in that mo. At the end of it all, display num of mos, total inch. rainfalland avg. rainfall per mo. per year for period. DO-WHILE-LOOP used for input validate No numbers accepted can be less than 1 for # yrs. No neg numbers accepted for mo. rainfall Thank you
Step by step
Solved in 3 steps with 1 images