import java.text.DecimalFormat;
import java.io.*;
import java.util.*;
public class RainFall{
public static void main(String[]
args)
{
Scanner kb=new
Scanner(System.in);
int years;
int
month=12;
double
total=0;
double average;
int
months[];
String input;
months = new
int[12];
DecimalFormat df = new
DecimalFormat("##0.00");
System.out.println("Enter the number
of years you wish to calculate. ");
input = kb.nextLine();
for(int y = 1;
y<=Integer.parseInt(input);
y++)
{
System.out.println("Enter the amount of rainfall in inches for year
#"+y+":");
years =
Integer.parseInt(input);
while (y < 1)
{
System.out.println("Do not accept a number less than 1 for the
number of years.");
}
for(int m = 1; m<=12; m++ )
{
System.out.println("Enter the amount of rainfall in inches for
month #" + m + ":");
months[m-1]=
kb.nextInt();
while (m
< 0)
{
System.out.println("Do not accept negative numbers for the monthly
rainfall.");
}
}
for(int i=0; i<12;i++)
{
total=
total+months[i];
}
System.out.println("The total amount
of rainfall for year " + y + " is " + total);
average = total/12;
System.out.println("The average of
rainfall for year " + y + " is " + average);
}
}
}
Write a program that uses nested loops to collect data and calculate the average rainfall over...
Average Rainfall Design a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of...
***** JAVA ONLY ***** Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. Frist the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the...
Design a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterte twelve times, onece for each month. Each itertion of the inner loop will ask the user for the inches of rainfall for tht month. After all iterations, the program should display the number of months, the...
5. Create a java application that uses nested loops to collect data and calculate the average rainfall over a peniod of years First the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month, the program should display the number of months, the total...
Write them in python IDLE *****
5. Average Rainfall
Write a program that uses nested loops to collect data
and calculate the average rainfall over a period of years. The
program should first ask for the number of years. The outer loop
will iterate once for each year. The inner loop will iterate twelve
times, once for each month. Each iteration of the inner loop will
ask the user for the inches of rainfall for that month. After all
iterations,...
Small Basic Programming Question: Average score Write a program that uses loops to collect data and calculate the average score over a number of tests for a number of students. The program should : 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the...
Small Basic Programming Question: Average Score- Write a program that uses loop to collect data and calculate the average score over a number of tests for a number of students. The program should: 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the scores...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON THE
INSTRUCTIONS AND ALGORITHM PROVIDED
home / study / engineering / computer science / questions and
answers / python programming - code the program based on ...
Your question has been answered! Rate it below.
Let us know if you got a helpful answer.
Question: PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON
THE...
Bookmark
PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON THE
INSTRUCTIONS AND ALGORITHM PROVIDED
Rainfall Algorithm
Declare and...
Write a Java program that calculates the average rainfall for three months. The program should ask the user to enter the name of each month such as June or July, and the amount of rain (in inches) that fell each month. The program should display a message similar to the following: The average rainfall for June, July, and August is 6.72 inches