Rewrite this program using and ArrayList. Assume that while entering temperature
ID: 3655674 • Letter: R
Question
Rewrite this program using and ArrayList. Assume that while entering temperatures from the keyboard -100 is the stopping condition. In other words, read temperatures from the keyboard until -100 temperature is entered. import java.util.Scanner; public class temp{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); double[] tempereture = new double[31]; for(int i=0; i < tempereture.length ; i++) tempereture[i] = scan.nextDouble(); int maxIndex = 0; for(int i=0; i < tempereture.length ; i++) { if(temperature[i] > temperature[maxIndex]) maxIndex = i; } System.out.println("heighest temperature is " + temperature[maxIndex]); }}Explanation / Answer
1) Average: int totalTemp = 0; int average = 0; for (int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.