Question
Assignment 2: Iterations and Arrays In this lab you will create a temperature analyzing system. For this lab assume that the user will input the
Assignment 2: Iterations and Arrays
In this lab you will create a temperature analyzing system. For this lab assume that the user will input the data for any number of days between 1 and 365 days. You will create a console java program that uses nested loops, logical structures, and arrays to read the low and high temperature of each day. You will need two Arrays, one to save the low temperatures and one for the high temperatures. Your program will calculate and display the average temperature of each day; It also needs to calculate and display the overall average, the day that had the lowest temperature and the day that had the highest temperature.
Getting User Input
The program should prompt for each temperature for each day, then displays the average temperature of that day before moving to the next day. The overall average, the lowest temperature, and the highest temperature of all the days should be the last output displayed.
Input Validation
Include range validation in your solutions. Days must be between 1 and 365 inclusive. The lowest temperature a user can input for a day is -45. The highest temperature a user can input for a day is 45. The low temperature of a day can not be higher than the high temperature of the same day. If the user input does not meet these requirements, the program should display an appropriate error message and re-prompt. Validation for non-numeric input is not required.
Processing and output
The daily high and low temperatures can be decimal. All output values need to be displayed to two decimal places.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started