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

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

3. Is it a topic that your audience will find worthwhile?

Answered: 1 week ago

Question

2. Does the topic meet the criteria specified in the assignment?

Answered: 1 week ago