Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the instructor). Program Name: Data Analysis.java You will write a program that will accept a text file containing the high temperature, low temperature and rainfall

image text in transcribed

the instructor). Program Name: Data Analysis.java You will write a program that will accept a text file containing the high temperature, low temperature and rainfall amount for each day of a given month of the year for a selected city. The first line has the year, month and city separated by tabs. The following lines contain the data separated by tabs. The data includes: the high temperature (int), the low temperature (int), and the rainfall amount (double). A sample text file is available in this submission. The program should loop so that the program can read and process more than one data file as needed by the user. The Java program will read in the month and year to determine the number of days in the month that the data was collected. You will use at least one separate method for this procedure and the method header will be, private static int numDaysInMonth (String month, int year). The program will read in the temperatures and rainfall amounts into three different arrays: two int arrays for high and low temperature and one double array for rainfall. The program will then calculate the average high temperature and average low temperature with no decimal places for the month. The program will also calculate the total rainfall for the month to two decimal places. You will use a method for both actions. One header will be private static int calculateAverage(int 0 temp). The other array method will be private static double calculateSum(double | rainfall). The program will write the results to a file called: dataOutput.txt. The first line of output will write the month, year and city name. You will then write average high temperature, average low temperature and total rainfall for the given month, year and city, each on a separate line. The program will then write to the file the data for each day of the month. This output will start with the given day, followed by the high temperature, low temperature and rainfall amount separated by ample whitespace. In addition, you will also write the following: For every day that is above the average, display a "+" beside the temperature. For every day that is below the average, display a "-" beside the temperature. For every rainfall amount greater than 0.00, display an "*" beside the rainfall amount. Numbers should line up so that the ones digits are all in the same column. the instructor). Program Name: Data Analysis.java You will write a program that will accept a text file containing the high temperature, low temperature and rainfall amount for each day of a given month of the year for a selected city. The first line has the year, month and city separated by tabs. The following lines contain the data separated by tabs. The data includes: the high temperature (int), the low temperature (int), and the rainfall amount (double). A sample text file is available in this submission. The program should loop so that the program can read and process more than one data file as needed by the user. The Java program will read in the month and year to determine the number of days in the month that the data was collected. You will use at least one separate method for this procedure and the method header will be, private static int numDaysInMonth (String month, int year). The program will read in the temperatures and rainfall amounts into three different arrays: two int arrays for high and low temperature and one double array for rainfall. The program will then calculate the average high temperature and average low temperature with no decimal places for the month. The program will also calculate the total rainfall for the month to two decimal places. You will use a method for both actions. One header will be private static int calculateAverage(int 0 temp). The other array method will be private static double calculateSum(double | rainfall). The program will write the results to a file called: dataOutput.txt. The first line of output will write the month, year and city name. You will then write average high temperature, average low temperature and total rainfall for the given month, year and city, each on a separate line. The program will then write to the file the data for each day of the month. This output will start with the given day, followed by the high temperature, low temperature and rainfall amount separated by ample whitespace. In addition, you will also write the following: For every day that is above the average, display a "+" beside the temperature. For every day that is below the average, display a "-" beside the temperature. For every rainfall amount greater than 0.00, display an "*" beside the rainfall amount. Numbers should line up so that the ones digits are all in the same column

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

More Books

Students also viewed these Databases questions

Question

What is diversity?

Answered: 1 week ago