import java.util.Scanner; // import library for scanner class public class weatherInput public static int inchesPerFoot = 12; public static void main(String[] arg) { scanner keyboard = new Scanner (System.in); // arrays with the months (ignore position 0) string months [] = {"", "Jannuary", "February", "March", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; //create keyboard object for system console // arrays for the precipitation double [] precip = new double[13]; int year; string city; do { system.out.printin("Weather Precipitation"); system.out.printin("Enter the year"); // user enter the year year = keyboard.nextInt(); if(year >= 1900 && year <= 2025) break; else System.out.printin(" Bad input -- Reenter\n"); System.out.printin("Enter the city"); // user enter the city city = keyboard.nextLine(); while(true); int weather = 0; double for (weather = 0; weather< 13; weather++ ) { system.out.printin(" please enter the precipition for the given month: " + months[weather] ); // User enter the precipitation precipitation = keyboard.nextDouble(); ation = 0; if(precipitation < 0) System.out.printin("Please enter positive number"); System.out.printin(" please enter the precipition for the given month: " + months[weather] );

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I got a lot of syntax errors but I don't know what the problem is 

import java.util.scanner; // import library for scanner class
7
public class weatherInput
9- {
8
public static int inchesPerFoot = 12;
public static void main(string[] arg)
{
Scanner keyboard = new Scanner (System.in);
// arrays with the months (ignore position 0)
string months [] = {"", "Jannuary", "February", "March", "March", "April", "May", "June", "July", "August", "September", "october", "November", "December"};
10
11
12 -
13
//create keyboard object for system console
14
15
16
// arrays for the precipitation
double [] precip = new double[13];
int year;
string city;
17
18
19
20
21
22
do
{
system.out.println("Weather Precipitation");
system.out.println("Enter the year"); // user enter the year
year = keyboard.nextInt();
if (year >= 1900 && year <= 2025)
break;
23 -
24
25
26
27
28
29
else
30
system.out.println(" Bad input -- Reenter\n");
31
32
system.out.println("Enter the city"); // user enter the city
city = keyboard.nextLine();
33
34
35
while(true);
36
37
int weather = 0;
%3D
double precipitation = 0;
for (weather = 0; weather< 13; weather++ )
{
system.out.println(" please enter the precipition for the given month: " + months[weather]); // User enter the precipitation
precipitation = keyboard.nextDouble();
38
39
40 -
41
42
43
if (precipitation < 0)
system.out.println("Please enter positive number");
system.out.println(" please enter the precipition for the given month: " + months[weather]);
44
45
46
47
while(precipitation>0);
48
Transcribed Image Text:import java.util.scanner; // import library for scanner class 7 public class weatherInput 9- { 8 public static int inchesPerFoot = 12; public static void main(string[] arg) { Scanner keyboard = new Scanner (System.in); // arrays with the months (ignore position 0) string months [] = {"", "Jannuary", "February", "March", "March", "April", "May", "June", "July", "August", "September", "october", "November", "December"}; 10 11 12 - 13 //create keyboard object for system console 14 15 16 // arrays for the precipitation double [] precip = new double[13]; int year; string city; 17 18 19 20 21 22 do { system.out.println("Weather Precipitation"); system.out.println("Enter the year"); // user enter the year year = keyboard.nextInt(); if (year >= 1900 && year <= 2025) break; 23 - 24 25 26 27 28 29 else 30 system.out.println(" Bad input -- Reenter\n"); 31 32 system.out.println("Enter the city"); // user enter the city city = keyboard.nextLine(); 33 34 35 while(true); 36 37 int weather = 0; %3D double precipitation = 0; for (weather = 0; weather< 13; weather++ ) { system.out.println(" please enter the precipition for the given month: " + months[weather]); // User enter the precipitation precipitation = keyboard.nextDouble(); 38 39 40 - 41 42 43 if (precipitation < 0) system.out.println("Please enter positive number"); system.out.println(" please enter the precipition for the given month: " + months[weather]); 44 45 46 47 while(precipitation>0); 48
double total = 0 ;
for (int months=0; i< month; i++)
total = (total + precipitation[months]) + inchesPerFoot;
50
51
52
53
54
system.out.println("Total precipitation" + total);
55
//get the average
double average;
average = total/months;
system.out.println("Average precipitation: " + average);
56
57
58
59
60
// highest precipitation
double highest = precipitation[0];
int index = 0;
for (int i =1; i < months; i++)
if(precipitation[i] > hiighest)
61
62
63
64
65
highest = precipitation[i];
index = i;
66
67
68
69
system.out.printf("Highest precipitation: %.2f in %s\n", highest, months[index] );
70
71
// lowest precipitation
double lowest = precipitation[0];
72
73
int index = 0;
for (int i =1; i < months; i++)
if(precipitation[i] > lowest)
lowest = precipitation[i];
index = i;
74
75
76
77
78
%3D
79
80
system.out.printf("Lowest precipitation: %.2f in %s\n", lowest, months[index] );
81
82
83
84
85
//for ()
86
87
}
}
88
89
Transcribed Image Text:double total = 0 ; for (int months=0; i< month; i++) total = (total + precipitation[months]) + inchesPerFoot; 50 51 52 53 54 system.out.println("Total precipitation" + total); 55 //get the average double average; average = total/months; system.out.println("Average precipitation: " + average); 56 57 58 59 60 // highest precipitation double highest = precipitation[0]; int index = 0; for (int i =1; i < months; i++) if(precipitation[i] > hiighest) 61 62 63 64 65 highest = precipitation[i]; index = i; 66 67 68 69 system.out.printf("Highest precipitation: %.2f in %s\n", highest, months[index] ); 70 71 // lowest precipitation double lowest = precipitation[0]; 72 73 int index = 0; for (int i =1; i < months; i++) if(precipitation[i] > lowest) lowest = precipitation[i]; index = i; 74 75 76 77 78 %3D 79 80 system.out.printf("Lowest precipitation: %.2f in %s\n", lowest, months[index] ); 81 82 83 84 85 //for () 86 87 } } 88 89
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education