Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please can someone give me a good Algorithm Pseudocode or Flowchart of this following java code / * * * * / public class WeatherTracker

Please can someone give me a good Algorithm Pseudocode or Flowchart of this following java code
/**
*
*/
public class WeatherTracker {
/**
* @param args
*/
@SuppressWarnings("resource")
public static void main(String[] args){
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("Welcome to the Weather App Program!!");
System.out.println("This program will determine the categories of weather temperatures.");
System.out.println("Enter the number of days you want to enter:");
int days = input.nextInt();
int[] temperatures = new int[days];
int hotDays =0, niceDays =0, moderateDays =0, coldDays =0;
double total =0;
for (int i =0; i < days; i++){
System.out.println("Enter temperature "+(i +1)+":");
temperatures[i]= input.nextInt();
total += temperatures[i];
if (temperatures[i]>=85){
hotDays++;
} else if (temperatures[i]>=70){
niceDays++;
} else if (temperatures[i]>=50){
moderateDays++;
} else {
coldDays++;
}
}
double average = total / days;
System.out.println("Hot Days: "+ hotDays);
System.out.println("Nice Days: "+ niceDays);
System.out.println("Moderate Days: "+ moderateDays);
System.out.println("Cold Days: "+ coldDays);
System.out.println("The average temperature was "+ average +" degrees.");
}
}

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

Students also viewed these Databases questions