Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; public class JLynch { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System .
import java.util.Scanner;
public class JLynch
public static void mainString args
Scanner scanner new ScannerSystemin;
String cities new String;
int snowfalls new int;
double totalSnowfall ;
double avgsnowfall;
Input city names and snowfall amounts
for int i ; i ; i
System.out.printlnEnter city name: ;
citiesi scanner.nextLine;
System.out.printlnEnter snowfall amount in inches for citiesi: ;
snowfallsi scanner.nextInt;
scanner.nextLine; to handle the newline character
Display city names and snowfall amounts
System.out.println
Snowfall amounts:";
for int i ; i ; i
System.out.printlncitiesi: snowfallsi inches";
totalSnowfall snowfallsi;
Compute the average snowfall
avgsnowfall totalSnowfall;
System.out.printlnTotal Snowfall totalSnowfall inches";
System.out.printlnAverage Snowfall avgsnowfall inches";
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