Чтение списка массивов из текста файла. (Цикл, формат для дня и первого / последнего дня, когда температура горячая)
Это моя домашняя работа на этой неделе. ---Им нужно:
Name: Eric Hornberger
Hometown: Columbus,Nebraska
Birthdate: 18 February 1960
Location: Columbus
Date AvgTemp MaxTemp MinTemp AvgSnow MaxSnow MinSnow AvgPrec MaxPrec MinPrec
August 2015 71.42 96 46 0.0 0.0 0.0 0.12 1.72 0.0
August 2014 76.06 96 51 0.0 0.0 0.0 0.24 2.66 0.0
August 2013 76.11 100 52 0.0 0.0 0.0 0.04 0.69 0.0
August 2012 74.45 103 44 0.0 0.0 0.0 0.01 0.13 0.0
August 2011 75.55 104 55 0.0 0.0 0.0 0.22 2.62 0.0
August 2010 78.11 100 52 0.0 0.0 0.0 0.09 0.84 0.0
August 2009 72.31 102 42 0.0 0.0 0.0 0.1 1.06 0.0
August 2008 75.42 102 50 0.0 0.0 0.0 0.06 0.46 0.0
August 2007 79.47 100 56 0.0 0.0 0.0 0.19 1.34 0.0
August 2006 75.68 105 52 0.0 0.0 0.0 0.13 1.71 0.0
For the past 10 years:
Average Temp: 75.46
Average Snow: 0.0
Average Precip: 0.12
Hottest August: 2006
Year FirstHotDay LastHotDay
2015 - -
2014 - -
2013 30 August 30 August
2012 01 August 30 August
2011 01 August 01 August
2010 12 August 12 August
2009 08 August 08 August
2008 03 August 03 August
2007 13 August 13 August
2006 01 August 09 August
Это моя работа, и я застрял прямо сейчас, пожалуйста, помогите мне. Я не знаю, как изменить день в файле.txt "20150822". Мой вывод показывает неправильный номер. Как я могу найти FirstHotDay и LastHotDay.
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.io.*;
import java.util.ArrayList;
import java.util.Date;
public class ClimateSummary {
public static void main (String [] args) throws FileNotFoundException {
File file = new File("dataB.txt");
Scanner scan = new Scanner(file);
String firstN = scan.next();
String lastN = scan.next();
System.out.println("Name: " + firstN + (" ") + lastN);
String city = scan.next();
String state = scan.next();
System.out.println("Hometown: " + city + (" ") + state);
String day = scan.next();
String month = scan.next();
String year = scan.next();
System.out.println("Birthdate: " + day + (" ") + month + (" ") + year);
String location = scan.next();
System.out.println("Location: " + location);
System.out.println("Date" + " " + "AvgTemp"
+" " + "MaxTemp" + " " + "MinTemp" + " " + "AvgSnow"
+ " " + "MaxSnow" + " " + "MinSnow" + " "
+ "AvgPrec" + " " + "MaxPrec" + " " + "MinPrec");
int[] stationNum = new int[310];
String[] dataYear = new String[310];
int[] highTemp = new int[310];
int[] lowTemp = new int[310];
int[] snowFall = new int[310];
double[] prec = new double[310];
double[] highLowTemp = new double[310];
double totalTemp15 = 0.0;
double totalTemp14 = 0.0;
double totalTemp13 = 0.0;
double totalTemp12 = 0.0;
double totalTemp11 = 0.0;
double totalTemp10 = 0.0;
double totalTemp9 = 0.0;
double totalTemp8 = 0.0;
double totalTemp7 = 0.0;
double totalTemp6 = 0.0;
String y2015;
int highestT15 = 0;
int lowestT15 = 0;
double avgsnow15 = 0.0;
double avgpre2015 = 0.0;
double avgT15 = 0.0;
int i;
for(i = 0; i < stationNum.length ;++i){
stationNum[i] = scan.nextInt();
dataYear[i] = scan.next();
highTemp[i] = scan.nextInt();
lowTemp[i] = scan.nextInt();
snowFall[i] = scan.nextInt();
prec[i] = scan.nextDouble();
//2015
if(i < 31) {
y2015 = dataYear[i];
totalTemp15 += (highTemp[i] + lowTemp[i]);
avgT15 +=totalTemp15;
avgT15 /= (highTemp.length + lowTemp.length) * 1.0;
if(totalTemp15 > highestT15)
{
totalTemp15 = highestT15;
}
if(totalTemp15 < lowestT15)
{
totalTemp15 = lowestT15;
}
double maxSnow15 = 0.0;
if(snowFall[i] > maxSnow15 ){
maxSnow15 = snowFall[i];
}
double minSnow15 = 0.0;
if(snowFall[i] < minSnow15){
minSnow15 = snowFall[i];
avgsnow15 += snowFall[i];
avgsnow15 += snowFall.length * 1.0;
}
double maxPr15 = 0.0;
if (prec[i] > maxPr15 ){
maxPr15 = prec[i];}
double minPr15 = 0.0;
if(prec[i] < minPr15 ) {
minPr15 = prec[i];
avgpre2015 += prec[i];
avgpre2015 += prec.length * 1.0;
System.out.println(y2015 + " " + avgT15 + " "+ highestT15 + " "+lowestT15 +" " + avgsnow15 + " "
+maxSnow15 + " " + minSnow15 + " "+ avgpre2015 + " " + maxPr15 + " " + minPr15 );
}
//2014
else if (i > 30 && i < 62) {
String y2014 = dataYear[i];
totalTemp14 += (highTemp[i] + lowTemp[i]);
double avgT14 = totalTemp14;
avgT14 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT14 = 0.0;
double lowestT14 = 0.0;
if(totalTemp14 > highestT14)
{
totalTemp14 = highestT14;
}
if(totalTemp14 < lowestT14)
{
totalTemp14 = lowestT14;
}
double maxSnow14 = 0.0;
if(snowFall[i] > maxSnow14 ){
maxSnow14 = snowFall[i];
}
double minSnow14 = 0.0;
double avgsnow14 = 0.0;
if(snowFall[i] < minSnow14){
minSnow14 = snowFall[i];
avgsnow14 += snowFall[i];
avgsnow14 += snowFall.length * 1.0;
double maxPr14 = 0.0;
if (prec[i] > maxPr14 ){
maxPr14 = prec[i];}
double minPr14 = 0.0;
if(prec[i] < minPr14 ) {
minPr14 = prec[i];
double avgpre2014 = 0.0;
avgpre2014 += prec[i];
avgpre2014 += prec.length * 1.0;
System.out.println(y2014 + " " + avgT14 + " "+ highestT14 + " "+lowestT14 +" " + avgsnow14 + " "
+maxSnow14 + " " + minSnow14 + " "+ avgpre2014 + " " + maxPr14 + " " + minPr14 );
}
//2013
else if (i > 61 && i < 93) {
String y2013 = dataYear[i];
totalTemp13 += (highTemp[i] + lowTemp[i]);
double avgT13 = totalTemp13;
avgT13 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT13 =0.0;
double lowestT13=0.0;
if(totalTemp13 > highestT13){
totalTemp13 = highestT13;}
if(totalTemp13 < lowestT13){
totalTemp13 = lowestT13; }
double maxSnow13 = 0.0;
if(snowFall[i] > maxSnow13 ){
maxSnow13 = snowFall[i];
}
double minSnow13 = 0.0;
double avgsnow13 = 0.0;
if(snowFall[i] < minSnow13){
minSnow13 = snowFall[i];
avgsnow13 += snowFall[i];
avgsnow13 += snowFall.length * 1.0;
double maxPr13 = 0.0;
if (prec[i] > maxPr14 ){
maxPr13 = prec[i];}
double minPr13 = 0.0;
if(prec[i] < minPr13 ) {
minPr13 = prec[i];
double avgpre2013 = 0.0;
avgpre2013 += prec[i];
avgpre2013 += prec.length * 1.0;
System.out.println(y2013 + " " + avgT13 + " "+ highestT13 + " "+lowestT13 +" " + avgsnow13 + " "
+maxSnow13 + " " + minSnow13 + " "+ avgpre2013 + " " + maxPr13 + " " + minPr13 );
}
//2012
else if (i > 92 && i < 124) {
String y2012 = dataYear[i];
totalTemp12 += (highTemp[i] + lowTemp[i]);
double avgT12 = totalTemp12;
avgT12 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT12 = 0.0;
double lowestT12 = 0.0;
if(totalTemp12 > highestT12)
{
totalTemp12 = highestT12;
}
if(totalTemp12 < lowestT12)
{
totalTemp12 = lowestT12; }
double maxSnow12 = 0.0;
if(snowFall[i] > maxSnow12 ){
maxSnow12 = snowFall[i];
}
double minSnow12 = 0.0;
double avgsnow12 = 0.0;
if(snowFall[i] < minSnow12){
minSnow12 = snowFall[i];
avgsnow12 += snowFall[i];
avgsnow12 += snowFall.length * 1.0;
}
double maxPr12 = 0.0;
if (prec[i] > maxPr12 ){
maxPr14 = prec[i];}
double minPr12 = 0.0;
if(prec[i] < minPr12 ) {
minPr12 = prec[i];
double avgpre2012 = 0.0;
avgpre2012 += prec[i];
avgpre2012 += prec.length * 1.0;
System.out.println(y2012 + " " + avgT12 + " "+ highestT12 + " "+lowestT12 +" " + avgsnow12 + " "
+maxSnow12 + " " + minSnow12 + " "+ avgpre2012 + " " + maxPr12 + " " + minPr12 );
}
//2011
else if (i > 123 && i < 155) {
String y2011 = dataYear[i];
totalTemp11 += (highTemp[i] + lowTemp[i]);
double avgT11 = totalTemp11;
avgT11 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT11 = 0.0;
double lowestT11 = 0.0;
if(totalTemp11 > highestT11)
{
totalTemp11 = highestT11;
}
if(totalTemp11 < lowestT11){
totalTemp11 = lowestT11;
}
double maxSnow11 = 0.0;
if(snowFall[i] > maxSnow11 ){
maxSnow11 = snowFall[i];
}
double minSnow11 = 0.0;
double avgsnow11 = 0.0;
if(snowFall[i] < minSnow11){
minSnow11 = snowFall[i];
avgsnow11 += snowFall[i];
avgsnow11 += snowFall.length * 1.0;
}
double maxPr11 = 0.0;
if (prec[i] > maxPr11 ){
maxPr11 = prec[i];}
double minPr11 = 0.0;
if(prec[i] < minPr11 ) {
minPr11 = prec[i];
double avgpre2011 = 0.0;
avgpre2011 += prec[i];
avgpre2011 += prec.length * 1.0;
System.out.println(y2011 + " " + avgT11 + " "+ highestT11 + " "+lowestT11 +" " + avgsnow11 + " "
+maxSnow11 + " " + minSnow11 + " "+ avgpre2011 + " " + maxPr11 + " " + minPr11 );
}
//2010
else if (i > 154 && i < 186) {
String y2010 = dataYear[i];
totalTemp10 += (highTemp[i] + lowTemp[i]);
double avgT10 = totalTemp10;
avgT10 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT10 = 0.0;
double lowestT10 = 0.0;
if(totalTemp10 > highestT10){
totalTemp10 = highestT10;}
if(totalTemp10 < lowestT10){
totalTemp10 = lowestT10;
}
double maxSnow10 = 0.0;
if(snowFall[i] > maxSnow10 ){
maxSnow10 = snowFall[i];
}
double minSnow10 = 0.0;
double avgsnow10 = 0.0;
if(snowFall[i] < minSnow10){
minSnow10 = snowFall[i];
avgsnow10 += snowFall[i];
avgsnow10 += snowFall.length * 1.0;
}
double maxPr10 = 0.0;
if (prec[i] > maxPr10 ){
maxPr10 = prec[i];}
double minPr10 = 0.0;
if(prec[i] < minPr10 ) {
minPr10 = prec[i];
double avgpre2010 = 0.0;
avgpre2010 += prec[i];
avgpre2010 += prec.length * 1.0;
System.out.println(y2010 + " " + avgT10 + " "+ highestT10 + " "+lowestT10 +" " + avgsnow10 + " "
+maxSnow10 + " " + minSnow10 + " "+ avgpre2010 + " " + maxPr10 + " " + minPr10 );
}
//2009
else if (i > 185 && i < 217) {
String y2009 = dataYear[i];
totalTemp9 += (highTemp[i] + lowTemp[i]);
double avgT9 = totalTemp9;
avgT9 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT9 = 0.0;
double lowestT9 = 0.0;
if(totalTemp9 > highestT9){
totalTemp9 = highestT9;}
if(totalTemp9 < lowestT9){
totalTemp9 = lowestT9;
}
double maxSnow9 = 0.0;
if(snowFall[i] > maxSnow9 ){
maxSnow9 = snowFall[i];
}
double minSnow9 = 0.0;
double avgsnow9 = 0.0;
if(snowFall[i] < minSnow9){
minSnow9 = snowFall[i];
avgsnow9 += snowFall[i];
avgsnow9 += snowFall.length * 1.0;
}
double maxPr9 = 0.0;
if (prec[i] > maxPr9 ){
maxPr9 = prec[i];}
double minPr9 = 0.0;
if(prec[i] < minPr9 ) {
minPr9 = prec[i];
double avgpre2009 = 0.0;
avgpre2009 += prec[i];
avgpre2009 += prec.length * 1.0;
System.out.println(y2009 + " " + avgT9 + " "+ highestT9 + " "+lowestT9 +" " + avgsnow9 + " "
+maxSnow9 + " " + minSnow9 + " "+ avgpre2009 + " " + maxPr9 + " " + minPr9 );
}
//2008
else if (i > 216 && i < 248) {
String y2008 = dataYear[i];
totalTemp8 += (highTemp[i] + lowTemp[i]);
double avgT8 = totalTemp8;
avgT8 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT8 = 0.0;
double lowestT8 = 0.0;
if(totalTemp8 > highestT8){
totalTemp8 = highestT8;}
if(totalTemp8 < lowestT8){
totalTemp8 = lowestT8;
}
double maxSnow8 = 0.0;
if(snowFall[i] > maxSnow8 ){
maxSnow8 = snowFall[i];
}
double minSnow8 = 0.0;
double avgsnow8 = 0.0;
if(snowFall[i] < minSnow8){
minSnow8 = snowFall[i];
avgsnow8 += snowFall[i];
avgsnow8 += snowFall.length * 1.0;
}
double maxPr8 = 0.0;
if (prec[i] > maxPr8 ){
maxPr8 = prec[i];}
double minPr8 = 0.0;
if(prec[i] < minPr8 ) {
minPr8 = prec[i];
double avgpre2008 = 0.0;
avgpre2008 += prec[i];
avgpre2008 += prec.length * 1.0;
System.out.println(y2008 + " " + avgT8 + " "+ highestT8 + " "+lowestT8 +" " + avgsnow8 + " "
+maxSnow8 + " " + minSnow8 + " "+ avgpre2008 + " " + maxPr8 + " " + minPr8 );
}
//2007
else if (i > 247 && i < 279) {
String y2007 = dataYear[i];
totalTemp7 += (highTemp[i] + lowTemp[i]);
double avgT7 = totalTemp7;
avgT7 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT7 = 0.0;
double lowestT7 = 0.0;
if(totalTemp7 > highestT7){
totalTemp7 = highestT7;}
if(totalTemp7 < lowestT7) {
totalTemp7 = lowestT7;
}
double maxSnow7 = 0.0;
if(snowFall[i] > maxSnow7 ){
maxSnow7 = snowFall[i];
}
double minSnow7 = 0.0;
double avgsnow7 = 0.0;
if(snowFall[i] < minSnow7){
minSnow7 = snowFall[i];
avgsnow7 += snowFall[i];
avgsnow7 += snowFall.length * 1.0;
}
double maxPr7 = 0.0;
if (prec[i] > maxPr7 ){
maxPr9 = prec[i];}
double minPr7 = 0.0;
if(prec[i] < minPr7 ) {
minPr7 = prec[i];
double avgpre2007 = 0.0;
avgpre2007 += prec[i];
avgpre2007 += prec.length * 1.0;
System.out.println(y2007 + " " + avgT7 + " "+ highestT7 + " "+lowestT7 +" " + avgsnow7 + " "
+maxSnow7 + " " + minSnow7 + " "+ avgpre2007 + " " + maxPr7 + " " + minPr7 );}
// 2006
else if (i > 278) {
String y2006 = dataYear[i];
totalTemp6 += (highTemp[i] + lowTemp[i]);
double avgT6 = totalTemp6;
avgT6 /= (highTemp.length + lowTemp.length) * 1.0;
double highestT6 = 0.0;
double lowestT6 = 0.0;
if(totalTemp6 > highestT6){
totalTemp6 = highestT6;
if(totalTemp6 < lowestT6){
totalTemp6 = lowestT6;
}
double maxSnow6 = 0.0;
if(snowFall[i] > maxSnow6 ){
maxSnow9 = snowFall[i];
}
double minSnow6 = 0.0;
double avgsnow6 = 0.0;
if(snowFall[i] < minSnow6){
minSnow6= snowFall[i];
avgsnow6 += snowFall[i];
avgsnow6 += snowFall.length * 1.0;
double maxPr6 = 0.0;
if (prec[i] > maxPr6 ){
maxPr6 = prec[i];}
double minPr6 = 0.0;
if(prec[i] < minPr6 ) {
minPr6 = prec[i];}
double avgpre2006 = 0.0;
avgpre2006 += prec[i];
avgpre2006 += prec.length * 1.0;
System.out.println(y2006 + " " + avgT6 + " "+ highestT6 + " "+lowestT6 +" " + avgsnow6 + " "
+maxSnow6 + " " + minSnow6 + " "+ avgpre2006 + " " + maxPr6 + " " + minPr6 );
// Past 10 years
System.out.println("For the past 10 year:");
double avgTemp = (avgT15+avgT14+avgT13+avgT12+
avgT11+avgT10+avgT9+avgT8+avgT7+avgT6)/10;
System.out.println("Average Temp: " + avgTemp);
double avgSnow = (avgsnow15+avgsnow14+avgsnow13+avgsnow12+avgsnow11+avgsnow10
+avgsnow9+avgsnow8+avgsnow7+avgsnow6) /10;
System.out.println("Average Snow: " + avgSnow);
double avgPrec = (avgpre2015+avgpre2014+avgpre2013+avgpre2012+avgpre2011
+avgpre2010+avgpre2009+avgpre2008+avgpre2007+avgpre2006) / 10;
System.out.println("Average Precip: " + avgPrec);
if(i < highTemp.length){
++i;
while()
}
}}}}}}}}}}}}}}}}}
Это файл данных: Имя Место рождения Дата рождения Место сбора данных, номер станции, Год MonthDay, высокая температура, низкая температура, снегопад,Precip.
John Fischer
Denver, Colorado
3 February 1980
Chicago
14939 20150801 89 63 0 0
14939 20150802 96 71 0 0
14939 20150803 86 67 0 0
14939 20150804 89 67 0 0.17
14939 20150805 83 70 0 0
14939 20150806 82 63 0 0.03
14939 20150807 93 67 0 0
14939 20150808 88 69 0 0.36
14939 20150809 89 74 0 0
14939 20150810 85 63 0 0
14939 20150811 87 58 0 0
14939 20150812 88 59 0 0
14939 20150813 90 62 0 0
14939 20150814 92 68 0 0
14939 20150815 92 64 0 0
14939 20150816 94 69 0 0
14939 20150817 78 68 0 1.72
14939 20150818 75 56 0 0.36
14939 20150819 77 53 0 0.08
14939 20150820 85 52 0 0
14939 20150821 86 64 0 0
14939 20150822 91 65 0 0.01
14939 20150823 76 50 0 0
14939 20150824 82 46 0 0
14939 20150825 82 51 0 0
14939 20150826 85 55 0 0
14939 20150827 87 66 0 0.31
14939 20150828 80 64 0 0.74
14939 20150829 74 61 0 0
14939 20150830 78 62 0 0
14939 20150831 88 62 0 0
14939 20140801 86 63 0 0
14939 20140802 90 59 0 0.06
14939 20140803 93 66 0 0
14939 20140804 87 64 0 0
14939 20140805 93 67 0 0
14939 20140806 83 71 0 0.21
14939 20140807 81 68 0 0
14939 20140808 83 70 0 0
14939 20140809 85 68 0 0.55
14939 20140810 85 68 0 0.08
14939 20140811 80 57 0 0
14939 20140812 81 51 0 0
14939 20140813 87 53 0 0
14939 20140814 89 57 0 0
14939 20140815 76 69 0 0.23
14939 20140816 87 69 0 0
14939 20140817 92 67 0 0.31
14939 20140818 91 62 0 0.01
14939 20140819 93 66 0 0
14939 20140820 96 74 0 0
14939 20140821 90 71 0 0.23
14939 20140822 93 73 0 0.18
14939 20140823 95 69 0 0.21
14939 20140824 91 70 0 0
14939 20140825 83 64 0 0
14939 20140826 81 63 0 1.45
14939 20140827 77 67 0 0.65
14939 20140828 82 69 0 2.66
14939 20140829 75 67 0 0
14939 20140830 87 64 0 0
14939 20140831 92 66 0 0.71
14939 20130801 89 62 0 0.69
14939 20130802 84 65 0 0.06
14939 20130803 80 62 0 0
14939 20130804 79 61 0 0
14939 20130805 86 70 0 0
14939 20130806 88 67 0 0
14939 20130807 85 66 0 0
14939 20130808 79 65 0 0
14939 20130809 83 60 0 0
14939 20130810 84 54 0 0
14939 20130811 87 61 0 0.01
14939 20130812 85 65 0 0.09
14939 20130813 80 60 0 0
14939 20130814 78 56 0 0
14939 20130815 70 63 0 0.25
14939 20130816 75 62 0 0
14939 20130817 80 60 0 0
14939 20130818 81 52 0 0
14939 20130819 87 63 0 0
14939 20130820 91 70 0 0
14939 20130821 92 69 0 0
14939 20130822 86 68 0 0.01
14939 20130823 92 71 0 0
14939 20130824 94 75 0 0
14939 20130825 96 73 0 0
14939 20130826 97 75 0 0
14939 20130827 98 72 0 0
14939 20130828 95 67 0 0
14939 20130829 98 68 0 0
14939 20130830 100 70 0 0
14939 20130831 96 72 0 0
14939 20120801 100 72 0 0
14939 20120802 96 70 0 0.11
14939 20120803 99 69 0 0
14939 20120804 84 59 0 0
14939 20120805 89 55 0 0
14939 20120806 97 60 0 0
14939 20120807 102 69 0 0
14939 20120808 103 67 0 0
14939 20120809 87 65 0 0
14939 20120810 82 55 0 0
14939 20120811 83 51 0 0.01
14939 20120812 84 63 0 0
14939 20120813 80 57 0 0
14939 20120814 87 57 0 0
14939 20120815 94 58 0 0
14939 20120816 77 49 0 0
14939 20120817 82 44 0 0
14939 20120818 78 45 0 0
14939 20120819 83 46 0 0
14939 20120820 89 48 0 0
14939 20120821 94 53 0 0
14939 20120822 93 58 0 0
14939 20120823 93 66 0 0
14939 20120824 77 68 0 0.13
14939 20120825 76 65 0 0.05
14939 20120826 85 62 0 0
14939 20120827 93 57 0 0
14939 20120828 97 60 0 0
14939 20120829 98 63 0 0
14939 20120830 100 66 0 0
14939 20120831 99 58 0 0
14939 20110801 104 75 0 0
14939 20110802 95 76 0 0
14939 20110803 89 69 0 0
14939 20110804 86 71 0 0.13
14939 20110805 85 71 0 0.45
14939 20110806 92 67 0 0.57
14939 20110807 88 68 0 0.02
14939 20110808 87 66 0 0.13
14939 20110809 84 63 0 0
14939 20110810 80 62 0 0
14939 20110811 85 56 0 1.06
14939 20110812 84 62 0 0.56
14939 20110813 83 62 0 0
14939 20110814 83 57 0 0
14939 20110815 79 65 0 0.64
14939 20110816 77 67 0 0
14939 20110817 85 65 0 0
14939 20110818 90 65 0 0.66
14939 20110819 84 63 0 0.05
14939 20110820 80 66 0 0
14939 20110821 85 61 0 0
14939 20110822 88 71 0 0
14939 20110823 95 76 0 0
14939 20110824 87 59 0 0
14939 20110825 84 55 0 0
14939 20110826 87 62 0 0
14939 20110827 86 61 0 0
14939 20110828 81 64 0 0
14939 20110829 82 57 0 0
14939 20110830 84 65 0 2.62
14939 20110831 92 66 0 0
14939 20100801 90 64 0 0
14939 20100802 94 74 0 0
14939 20100803 91 73 0 0
14939 20100804 88 70 0 0.44
14939 20100805 87 66 0 0
14939 20100806 87 66 0 0
14939 20100807 92 68 0 0
14939 20100808 98 75 0 0
14939 20100809 95 72 0 0
14939 20100810 96 74 0 0
14939 20100811 99 69 0 0
14939 20100812 100 67 0 0
14939 20100813 95 70 0 0.02
14939 20100814 92 63 0 0
14939 20100815 86 57 0 0
14939 20100816 90 59 0 0.27
14939 20100817 69 64 0 0.18
14939 20100818 84 65 0 0
14939 20100819 95 65 0 0
14939 20100820 89 72 0 0.09
14939 20100821 95 67 0 0
14939 20100822 94 64 0 0
14939 20100823 94 66 0 0.27
14939 20100824 81 56 0 0.7
14939 20100825 85 52 0 0
14939 20100826 87 57 0 0
14939 20100827 87 54 0 0
14939 20100828 91 58 0 0
14939 20100829 93 63 0 0
14939 20100830 94 73 0 0
14939 20100831 94 68 0 0.84
14939 20090801 78 58 0 0
14939 20090802 94 54 0 0
14939 20090803 94 65 0 0
14939 20090804 88 66 0 0.07
14939 20090805 85 63 0 0.04
14939 20090806 84 59 0 0
14939 20090807 97 73 0 0.04
14939 20090808 102 76 0 0
14939 20090809 83 66 0 0.11
14939 20090810 88 59 0 0
14939 20090811 89 57 0 0
14939 20090812 96 66 0 0
14939 20090813 93 65 0 0
14939 20090814 93 62 0 0
14939 20090815 84 67 0 0.95
14939 20090816 81 63 0 0.6
14939 20090817 83 57 0 0
14939 20090818 84 58 0 0
14939 20090819 83 66 0 0.33
14939 20090820 77 59 0 0
14939 20090821 74 53 0 0
14939 20090822 79 48 0 0
14939 20090823 83 55 0 0
14939 20090824 91 63 0 0
14939 20090825 86 70 0 0
14939 20090826 77 66 0 1.06
14939 20090827 78 58 0 0
14939 20090828 78 52 0 0
14939 20090829 72 51 0 0
14939 20090830 71 48 0 0
14939 20090831 73 42 0 0
14939 20080801 93 71 0 0
14939 20080802 99 73 0 0
14939 20080803 102 70 0 0
14939 20080804 93 75 0 0
14939 20080805 85 65 0 0
14939 20080806 86 63 0 0
14939 20080807 90 60 0 0
14939 20080808 90 61 0 0
14939 20080809 81 66 0 0.24
14939 20080810 88 59 0 0.26
14939 20080811 84 65 0 0.4
14939 20080812 87 63 0 0.02
14939 20080813 91 65 0 0
14939 20080814 86 66 0 0
14939 20080815 84 62 0 0
14939 20080816 84 58 0 0
14939 20080817 86 55 0 0
14939 20080818 89 60 0 0
14939 20080819 88 60 0 0
14939 20080820 87 57 0 0
14939 20080821 84 66 0 0
14939 20080822 95 70 0 0
14939 20080823 83 63 0 0
14939 20080824 83 61 0 0.46
14939 20080825 83 56 0 0
14939 20080826 82 59 0 0
14939 20080827 87 64 0 0.4
14939 20080828 90 57 0 0
14939 20080829 89 50 0 0
14939 20080830 91 54 0 0
14939 20080831 93 69 0 0
14939 20070801 89 68 0 0.28
14939 20070802 90 66 0 0
14939 20070803 90 67 0 0.16
14939 20070804 96 76 0 0
14939 20070805 92 74 0 0
14939 20070806 93 73 0 0.21
14939 20070807 85 72 0 0.44
14939 20070808 90 72 0 1.34
14939 20070809 96 74 0 0
14939 20070810 96 67 0 0.46
14939 20070811 97 72 0 0
14939 20070812 95 72 0 0.12
14939 20070813 100 70 0 0
14939 20070814 98 75 0 0
14939 20070815 92 71 0 0
14939 20070816 83 72 0 0.11
14939 20070817 85 71 0 0.1
14939 20070818 93 73 0 0
14939 20070819 91 73 0 0
14939 20070820 96 70 0 0.39
14939 20070821 95 70 0 0
14939 20070822 88 67 0 0.96
14939 20070823 86 67 0 0.55
14939 20070824 75 63 0 0.01
14939 20070825 81 58 0 0
14939 20070826 89 68 0 0
14939 20070827 95 75 0 0
14939 20070828 94 67 0 0.65
14939 20070829 76 62 0 0.02
14939 20070830 80 57 0 0
14939 20070831 83 56 0 0
14939 20060801 105 79 0 0
14939 20060802 85 65 0 0
14939 20060803 90 58 0 0
14939 20060804 91 54 0 0
14939 20060805 102 70 0 0.1
14939 20060806 91 72 0 0.4
14939 20060807 82 67 0 0.09
14939 20060808 86 66 0 1.71
14939 20060809 100 74 0 0
14939 20060810 90 74 0 0.04
14939 20060811 91 69 0 0
14939 20060812 90 70 0 0
14939 20060813 82 71 0 0.11
14939 20060814 83 58 0 0
14939 20060815 85 53 0 0
14939 20060816 87 64 0 0.49
14939 20060817 90 70 0 0.14
14939 20060818 88 69 0 0.6
14939 20060819 78 61 0 0.09
14939 20060820 81 57 0 0
14939 20060821 89 60 0 0
14939 20060822 87 63 0 0
14939 20060823 91 63 0 0
14939 20060824 95 68 0 0
14939 20060825 83 68 0 0.02
14939 20060826 80 63 0 0
14939 20060827 76 62 0 0.26
14939 20060828 67 63 0 0
14939 20060829 80 59 0 0
14939 20060830 82 52 0 0
14939 20060831 83 60 0 0
Это мой вывод:
Name: John Fischer
Hometown: Denver, Colorado
Birthdate: 3 February 1980
Location: Chicago
Date AvgTemp MaxTemp MinTemp AvgSnow MaxSnow MinSnow AvgPrec MaxPrec MinPrec
1 ответ
Включите это:
if(prec[i] < minPr15 ) {
minPr15 = prec[i];
в это:
if(prec[i] <= minPr15 ) {
minPr15 = prec[i];
И это будет печатать. Выясните, что не так с остальными вашими расчетами. Кроме того, просто выделите первый год (2015) и поймите это правильно.