Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Project 10: Using the file of sunset data given in class, write a program using

ID: 3825178 • Letter: P

Question

Project 10:

Using the file of sunset data given in class, write a program using graphics that shows the sunset and sunrise. (Put sunData.txt in bin)

Below is an example Graphics code:

the sunData.txt file is given below [f.y.i it is LoooooooNG ;)]

sunData.txt

1 7 21 16 44

2 7 21 16 45

3 7 21 16 46

4 7 21 16 47

5 7 21 16 48

6 7 21 16 49

7 7 21 16 50

8 7 21 16 51

9 7 21 16 52

10 7 20 16 53

11 7 20 16 54

12 7 20 16 55

13 7 20 16 56

14 7 19 16 57

15 7 19 16 58

16 7 18 17 0

17 7 18 17 1

18 7 18 17 2

19 7 17 17 3

20 7 16 17 4

21 7 16 17 5

22 7 15 17 6

23 7 15 17 8

24 7 14 17 9

25 7 13 17 10

26 7 12 17 11

27 7 12 17 12

28 7 11 17 14

29 7 10 17 15

30 7 9 17 16

31 7 8 17 17

1 7 8 17 18

2 7 7 17 19

3 7 6 17 20

4 7 5 17 22

5 7 4 17 23

6 7 3 17 24

7 7 2 17 25

8 7 1 17 26

9 6 59 17 28

10 6 58 17 29

11 6 57 17 30

12 6 56 17 31

13 6 55 17 32

14 6 53 17 33

15 6 52 17 35

16 6 51 17 36

17 6 50 17 37

18 6 48 17 38

19 6 47 17 39

20 6 46 17 40

21 6 44 17 42

22 6 43 17 43

23 6 41 17 44

24 6 40 17 45

25 6 38 17 46

26 6 37 17 47

27 6 36 17 48

28 6 34 17 49

1 6 33 17 51

2 6 31 17 52

3 6 30 17 53

4 6 28 17 54

5 6 27 17 55

6 6 25 17 56

7 6 23 17 57

8 6 22 17 58

9 6 20 17 59

10 6 19 18 0

11 6 17 18 1

12 6 16 18 2

13 6 14 18 3

14 6 12 18 5

15 6 11 18 6

16 6 9 18 7

17 6 8 18 8

18 6 6 18 9

19 6 4 18 10

20 6 3 18 11

21 6 1 18 12

22 5 59 18 13

23 5 58 18 14

24 5 56 18 15

25 5 55 18 16

26 5 53 18 17

27 5 51 18 18

28 5 50 18 19

29 5 48 18 20

30 5 46 18 21

31 5 45 18 22

1 5 43 18 23

2 5 42 18 24

3 5 40 18 25

4 5 38 18 26

5 5 37 18 27

6 5 35 18 28

7 5 34 18 29

8 5 32 18 30

9 5 31 18 31

10 5 29 18 32

11 5 27 18 33

12 5 26 18 34

13 5 24 18 35

14 5 23 18 36

15 5 21 18 37

16 5 20 18 38

17 5 18 18 39

18 5 17 18 40

19 5 15 18 41

20 5 14 18 42

21 5 13 18 43

22 5 11 18 44

23 5 10 18 45

24 5 8 18 46

25 5 7 18 47

26 5 6 18 48

27 5 4 18 49

28 5 3 18 50

29 5 2 18 51

30 5 0 18 52

1 4 59 18 53

2 4 58 18 54

3 4 57 18 55

4 4 56 18 56

5 4 54 18 57

6 4 53 18 58

7 4 52 18 59

8 4 51 19 0

9 4 50 19 1

10 4 49 19 2

11 4 48 19 3

12 4 47 19 4

13 4 46 19 5

14 4 45 19 6

15 4 44 19 7

16 4 43 19 8

17 4 42 19 9

18 4 41 19 10

19 4 40 19 11

20 4 40 19 12

21 4 39 19 13

22 4 38 19 13

23 4 37 19 14

24 4 37 19 15

25 4 36 19 16

26 4 35 19 17

27 4 35 19 18

28 4 34 19 18

29 4 34 19 19

30 4 33 19 20

31 4 33 19 21

1 4 32 19 22

2 4 32 19 22

3 4 32 19 23

4 4 31 19 24

5 4 31 19 24

6 4 31 19 25

7 4 30 19 25

8 4 30 19 26

9 4 30 19 27

10 4 30 19 27

11 4 30 19 28

12 4 30 19 28

13 4 30 19 29

14 4 30 19 29

15 4 30 19 29

16 4 30 19 30

17 4 30 19 30

18 4 30 19 31

19 4 30 19 31

20 4 30 19 31

21 4 30 19 31

22 4 31 19 32

23 4 31 19 32

24 4 31 19 32

25 4 32 19 32

26 4 32 19 32

27 4 32 19 32

28 4 33 19 32

29 4 33 19 32

30 4 34 19 32

1 4 34 19 32

2 4 35 19 32

3 4 35 19 32

4 4 36 19 31

5 4 36 19 31

6 4 37 19 31

7 4 37 19 31

8 4 38 19 30

9 4 39 19 30

10 4 39 19 30

11 4 40 19 29

12 4 41 19 29

13 4 41 19 28

14 4 42 19 28

15 4 43 19 27

16 4 44 19 27

17 4 44 19 26

18 4 45 19 25

19 4 46 19 25

20 4 47 19 24

21 4 48 19 23

22 4 49 19 23

23 4 49 19 22

24 4 50 19 21

25 4 51 19 20

26 4 52 19 19

27 4 53 19 18

28 4 54 19 17

29 4 55 19 16

30 4 56 19 15

31 4 57 19 14

1 4 58 19 13

2 4 58 19 12

3 4 59 19 11

4 5 0 19 10

5 5 1 19 9

6 5 2 19 8

7 5 3 19 7

8 5 4 19 6

9 5 5 19 4

10 5 6 19 3

11 5 7 19 2

12 5 8 19 0

13 5 9 18 59

14 5 10 18 58

15 5 11 18 57

16 5 12 18 55

17 5 13 18 54

18 5 14 18 52

19 5 15 18 51

20 5 16 18 50

21 5 16 18 48

22 5 17 18 47

23 5 18 18 45

24 5 19 18 44

25 5 20 18 42

26 5 21 18 41

27 5 22 18 39

28 5 23 18 38

29 5 24 18 36

30 5 25 18 35

31 5 26 18 33

1 5 27 18 31

2 5 28 18 30

3 5 29 18 28

4 5 30 18 27

5 5 31 18 25

6 5 32 18 23

7 5 33 18 22

8 5 33 18 20

9 5 35 18 18

10 5 35 18 17

11 5 36 18 15

12 5 37 18 14

13 5 38 18 12

14 5 39 18 10

15 5 40 18 9

16 5 41 18 7

17 5 42 18 5

18 5 43 18 4

19 5 44 18 2

20 5 45 18 0

21 5 46 17 59

22 5 47 17 57

23 5 48 17 55

24 5 49 17 54

25 5 50 17 52

26 5 51 17 51

27 5 52 17 49

28 5 52 17 47

29 5 53 17 46

30 5 54 17 44

1 5 55 17 42

2 5 56 17 41

3 5 57 17 39

4 5 58 17 37

5 5 59 17 36

6 6 0 17 34

7 6 1 17 33

8 6 2 17 31

9 6 3 17 30

10 6 4 17 28

11 6 5 17 26

12 6 7 17 25

13 6 8 17 23

14 6 9 17 22

15 6 10 17 20

16 6 11 17 19

17 6 12 17 17

18 6 13 17 16

19 6 14 17 15

20 6 15 17 13

21 6 16 17 12

22 6 17 17 10

23 6 18 17 9

24 6 19 17 8

25 6 20 17 6

26 6 22 17 5

27 6 23 17 4

28 6 24 17 2

29 6 25 17 1

30 6 26 17 0

31 6 27 16 59

1 6 28 16 57

2 6 29 16 56

3 6 30 16 56

4 6 32 16 54

5 6 33 16 53

6 6 34 16 52

7 6 35 16 51

8 6 36 16 50

9 6 37 16 49

10 6 39 16 48

11 6 40 16 47

12 6 41 16 46

13 6 42 16 46

14 6 43 16 44

15 6 44 16 43

16 6 46 16 42

17 6 47 16 42

18 6 48 16 41

19 6 49 16 40

20 6 50 16 40

21 6 51 16 39

22 6 52 16 38

23 6 53 16 38

24 6 54 16 37

25 6 56 16 37

26 6 57 16 36

27 6 58 16 36

28 6 59 16 36

29 7 0 16 35

30 7 1 16 35

1 7 2 16 35

2 7 3 16 35

3 7 4 16 34

4 7 5 16 34

5 7 6 16 34

6 7 7 16 34

7 7 8 16 34

8 7 8 16 34

9 7 9 16 34

10 7 10 16 34

11 7 11 16 34

12 7 12 16 34

13 7 12 16 34

14 7 13 16 35

15 7 14 16 35

16 7 15 16 35

17 7 15 16 35

18 7 16 16 36

19 7 16 16 36

20 7 17 16 37

21 7 18 16 37

22 7 18 16 38

23 7 19 16 38

24 7 19 16 39

25 7 19 16 39

26 7 20 16 40

27 7 20 16 41

28 7 20 16 41

29 7 21 16 42

30 7 21 16 43

31 7 21 16 43

Please do the project in java:

output sholud look like this picture!

4:00 AM 5:00 AM 6:00 AM 7:00 AM 8:00 AM 4:00 PM 5:00 PM 6:00 PM 7:00 PM 8:00 PM Sun Set and Sun Rise Graph Dec Jan Feb March April May June July Aug Sept Oct Nov

Explanation / Answer

/plot sunrises and sunsets for a year //the following data was 2007 data parsed from the output at http://aa.usno.navy.mil/data/docs/RS_OneYear.php //the *min values are "minutes of the day" (i.e. max would be 24 * 60) //monthdayptr is the starting day ptr for each month. float sunrisemin[] = {433,434,434,434,434,433,433,433,433,433,432,432,432,431,431,430,430,429,429,428,428,427,426,425,425,424,423,422,421,420,419,418,417,416,415,414,413,412,410,409,408,407,405,404,403,401,400,398,397,396,394,393,391,390,388,387,385,383,382,380,379,377,375,374,372,370,369,367,365,364,362,360,359,357,355,353,352,350,348,347,345,343,341,340,338,336,334,333,331,329,327,326,324,322,321,319,317,316,314,312,311,309,307,306,304,302,301,299,298,296,295,293,292,290,289,287,286,284,283,282,280,279,277,276,275,274,272,271,270,269,268,267,265,264,263,262,261,260,260,259,258,257,256,255,255,254,253,253,252,251,251,250,250,250,249,249,248,248,248,248,247,247,247,247,247,247,247,247,247,247,248,248,248,248,248,249,249,249,250,250,251,251,252,252,253,254,254,255,255,256,257,258,258,259,260,261,262,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,335,336,337,338,339,340,341,342,343,344,345,347,348,349,350,351,352,353,354,356,357,358,359,360,361,363,364,365,366,367,369,370,371,372,373,375,376,377,378,380,381,382,383,385,386,387,388,390,391,392,393,395,396,397,398,400,401,402,403,404,406,407,408,409,410,411,412,413,414,416,417,418,419,419,420,421,422,423,424,425,425,426,427,428,428,429,429,430,430,431,431,432,432,432,433,433,433,433}; float sunsetmin[] = {982,983,984,985,986,987,988,989,990,991,992,993,995,996,997,998,999,1000,1002,1003,1004,1005,1007,1008,1009,1010,1012,1013,1014,1016,1017,1018,1019,1021,1022,1023,1025,1026,1027,1029,1030,1031,1032,1034,1035,1036,1038,1039,1040,1041,1043,1044,1045,1046,1048,1049,1050,1051,1053,1054,1055,1056,1058,1059,1060,1061,1062,1063,1065,1066,1067,1068,1069,1071,1072,1073,1074,1075,1076,1077,1079,1080,1081,1082,1083,1084,1085,1086,1088,1089,1090,1091,1092,1093,1094,1095,1097,1098,1099,1100,1101,1102,1103,1104,1106,1107,1108,1109,1110,1111,1112,1113,1115,1116,1117,1118,1119,1120,1121,1122,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1147,1148,1149,1150,1151,1152,1153,1153,1154,1155,1156,1156,1157,1158,1158,1159,1160,1160,1161,1161,1162,1162,1163,1163,1163,1164,1164,1164,1165,1165,1165,1165,1165,1165,1165,1165,1165,1165,1165,1165,1165,1164,1164,1164,1163,1163,1163,1162,1162,1161,1161,1160,1159,1159,1158,1157,1157,1156,1155,1154,1153,1152,1151,1150,1149,1148,1147,1146,1145,1144,1143,1142,1141,1139,1138,1137,1135,1134,1133,1131,1130,1129,1127,1126,1124,1123,1121,1120,1118,1117,1115,1114,1112,1110,1109,1107,1106,1104,1102,1101,1099,1097,1095,1094,1092,1090,1089,1087,1085,1083,1082,1080,1078,1076,1075,1073,1071,1069,1068,1066,1064,1062,1060,1059,1057,1055,1053,1052,1050,1048,1046,1045,1043,1041,1039,1038,1036,1034,1033,1031,1029,1028,1026,1025,1023,1021,1020,1018,1017,1015,1014,1012,1011,1009,1008,1006,1005,1003,1002,1001,999,998,997,996,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,979,979,978,977,977,976,976,975,975,974,974,973,973,973,972,972,972,972,972,972,972,972,972,972,972,972,973,973,973,974,974,974,975,975,976,976,977,978,978,979,980,981,981}; float monthdayptr[] = {0,31,59,90,120,151,181,212,243,273,304,334}; //as an afterthought I used the same script to parse the civil twilight... float twistartmin[] = {402,402,402,402,402,402,402,402,402,401,401,401,401,400,400,400,399,399,398,398,397,396,396,395,394,394,393,392,391,390,389,388,387,386,385,384,383,382,381,380,379,377,376,375,374,372,371,370,368,367,366,364,363,361,360,358,357,355,354,352,351,349,347,346,344,342,341,339,337,336,334,332,331,329,327,326,324,322,320,319,317,315,313,312,310,308,306,304,303,301,299,297,296,294,292,290,289,287,285,283,282,280,278,277,275,273,272,270,268,267,265,263,262,260,259,257,256,254,252,251,250,248,247,245,244,242,241,240,239,237,236,235,234,232,231,230,229,228,227,226,225,224,223,222,221,221,220,219,218,218,217,217,216,216,215,215,214,214,214,213,213,213,213,212,212,212,212,212,212,213,213,213,213,213,214,214,214,215,215,216,216,217,217,218,219,219,220,221,221,222,223,224,225,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,243,244,245,246,247,248,249,250,252,253,254,255,256,257,259,260,261,262,263,264,266,267,268,269,270,271,272,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,292,294,295,296,297,298,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,317,318,320,321,322,323,324,325,326,327,329,330,331,332,333,334,335,336,338,339,340,341,342,343,345,346,347,348,349,350,352,353,354,355,356,357,359,360,361,362,363,364,366,367,368,369,370,371,372,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,390,391,392,393,394,394,395,396,396,397,397,398,399,399,399,400,400,401,401,401,401,402}; float twistopmin[] = {1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1034,1035,1036,1037,1038,1039,1041,1042,1043,1044,1045,1047,1048,1049,1050,1052,1053,1054,1055,1057,1058,1059,1060,1062,1063,1064,1065,1066,1068,1069,1070,1071,1073,1074,1075,1076,1077,1079,1080,1081,1082,1083,1084,1086,1087,1088,1089,1090,1091,1093,1094,1095,1096,1097,1098,1100,1101,1102,1103,1104,1105,1107,1108,1109,1110,1111,1112,1114,1115,1116,1117,1118,1119,1121,1122,1123,1124,1125,1126,1128,1129,1130,1131,1132,1134,1135,1136,1137,1138,1140,1141,1142,1143,1144,1146,1147,1148,1149,1151,1152,1153,1154,1155,1157,1158,1159,1160,1161,1163,1164,1165,1166,1167,1169,1170,1171,1172,1173,1174,1175,1176,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1187,1188,1189,1190,1191,1191,1192,1193,1194,1194,1195,1195,1196,1197,1197,1197,1198,1198,1199,1199,1199,1199,1200,1200,1200,1200,1200,1200,1200,1200,1200,1199,1199,1199,1199,1198,1198,1198,1197,1197,1196,1196,1195,1194,1194,1193,1192,1191,1191,1190,1189,1188,1187,1186,1185,1184,1183,1182,1181,1179,1178,1177,1176,1175,1173,1172,1171,1169,1168,1166,1165,1164,1162,1161,1159,1158,1156,1154,1153,1151,1150,1148,1146,1145,1143,1141,1140,1138,1136,1135,1133,1131,1129,1128,1126,1124,1122,1121,1119,1117,1115,1114,1112,1110,1108,1106,1105,1103,1101,1099,1097,1096,1094,1092,1090,1088,1087,1085,1083,1081,1080,1078,1076,1074,1073,1071,1069,1068,1066,1064,1062,1061,1059,1058,1056,1054,1053,1051,1050,1048,1047,1045,1044,1042,1041,1039,1038,1036,1035,1034,1032,1031,1030,1029,1027,1026,1025,1024,1023,1022,1020,1019,1018,1017,1016,1016,1015,1014,1013,1012,1011,1011,1010,1009,1009,1008,1007,1007,1006,1006,1006,1005,1005,1005,1004,1004,1004,1004,1004,1004,1003,1003,1004,1004,1004,1004,1004,1004,1005,1005,1005,1005,1006,1006,1007,1007,1008,1008,1009,1010,1010,1011,1012,1012,1013}; int daycount = 365; String monthCap[] = {"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"}; //in 2007, march 11 was start of DST float DSTstart = monthdayptr[2] + 11; float DSTend = monthdayptr[10] + 4; int SCREENWIDTH = 365; int SCREENHEIGHT = 365; size(365,365); stroke(255,128); background(0,0,60); float BOXHEIGHT = SCREENHEIGHT ; float BOXWIDTH = 365; float MAXMIN = 24 * 60; textFont(loadFont("LucidaSans-8.vlw")); //line(BOXLEFT-1,BOXTOP,BOXLEFT-1,BOXTOP+BOXHEIGHT); float loc; for(int i = 0; i < 24; i++){ loc = (((i*60.0)/MAXMIN)*BOXHEIGHT); line(0,loc,BOXWIDTH,loc); int h = i%12; String hr = new Integer(h).toString(); if(hr.length() < 2) { hr = "0"+hr; } if(hr.equals("00")) { hr = "12";} if(i < 12){ hr += "a"; } else { hr += "p"; } text(hr,16,loc+10); } //so with the noon, 3 and 6 lines, we want draw DST versions... float loc12 = (((12*60.0)/MAXMIN)*BOXHEIGHT); float loc6 = (((6*60.0)/MAXMIN)*BOXHEIGHT); float loc18 = (((18*60.0)/MAXMIN)*BOXHEIGHT); float loc12dst = (((11*60.0)/MAXMIN)*BOXHEIGHT); float loc6dst = (((5*60.0)/MAXMIN)*BOXHEIGHT); float loc18dst = (((17*60.0)/MAXMIN)*BOXHEIGHT); stroke(255,255,0,128); line(0,loc12,DSTstart,loc12); line(0,loc6,DSTstart,loc6); line(0,loc18,DSTstart,loc18); line(DSTstart,loc12dst,DSTend,loc12dst); line(DSTstart,loc6dst,DSTend,loc6dst); line(DSTstart,loc18dst,DSTend,loc18dst); line(DSTend,loc12,BOXWIDTH,loc12); line(DSTend,loc6,BOXWIDTH,loc6); line(DSTend,loc18,BOXWIDTH,loc18); //draw month lines stroke(128,128,255,128); for(int i = 1; i < 12; i++){ line(monthdayptr[i],0,monthdayptr[i], BOXHEIGHT); } for(int i = 0; i < 12; i++){ text(monthCap[i],monthdayptr[i]+3,362); } //draw line for day in year... Calendar rightNow = Calendar.getInstance(); int dayOfYear = rightNow.get(Calendar.DAY_OF_YEAR);; stroke(200,20,20,240); line(dayOfYear,0,dayOfYear,BOXHEIGHT); //then draw in line of daylight for(int i = 0; i