Question: the date class is below: 4 public class Date { 5 //Data members 6 private int day,month,year; 7 //Default constructor 8 public Date() { 9

 the date class is below: 4 public class Date { 5
//Data members 6 private int day,month,year; 7 //Default constructor 8 public Date()
the date class is below:
4 public class Date {
5 //Data members
6 private int day,month,year;
7 //Default constructor
8 public Date() {
9 day=month=year=0;
10 }
11 //Int overloaded construcor
12 public Date(int d,int m,int y) {
13 day=d;
14 month=m;
15 year=y;
16 }
17 //String overloaded construcor
18 public Date(int d,String m,int y) {
19 day=d;
20 year=y;
21 if(m.compareToIgnoreCase("January")==0) {
22 month=1;
23 }
24 else if(m.compareToIgnoreCase("February")==0) {
25 month=2;
26 }
27 else if(m.compareToIgnoreCase("March")==0) {
28 month=3;
29 }
30 else if(m.compareToIgnoreCase("April")==0) {
31 month=4;
32 }
33 else if(m.compareToIgnoreCase("May")==0) {
34 month=5;
35 }
36 else if(m.compareToIgnoreCase("June")==0) {
37 month=6;
38 }
39 else if(m.compareToIgnoreCase("July")==0) {
40 month=7;
41 }
42 else if(m.compareToIgnoreCase("August")==0) {
43 month=8;
44 }
45 else if(m.compareToIgnoreCase("September")==0) {
46 month=9;
47 }
48 else if(m.compareToIgnoreCase("October")==0) {
49 month=10;
50 }
51 else if(m.compareToIgnoreCase("December")==0) {
52 month=11;
53 }
54 else {
55 month=12;
56 }
57 }
58 //Int overloaded constructor
59 public Date(int days,int yr) {
60 year=yr;
61 if(days
62 month=1;
63 day=days;
64 }
65 else if(days
66 month=2;
67 day=days-31;
68 }
69 else if(days
70 month=3;
71 day=days-59;
72 }
73 else if(days
74 month=4;
75 day=days-90;
76 }
77 else if(days
78 month=5;
79 day=days-120;
80 }
81 else if(days
82 month=6;
83 day=days-151;
84 }
85 else if(days
86 month=7;
87 day=days-181;
88 }
89 else if(days
90 month=8;
91 day=days-212;
92 }
93 else if(days
94 month=9;
95 day=days-243;
96 }
97 else if(days
98 month=10;
99 day=days-273;
100 }
101 else if(days
102 month=11;
103 day=days-304;
104 }
105 else {
106 month=12;
107 day=days-334;
108 }
109 }
110 //Return 3 date formatted string
111 public String toString() {
112 String str="DD/MM/YYYY: "+month+"/"+day+"/"+year+" Month DD, YYYY: ";
113 if(month==1) {
114 str+="January ";
115 }
116 else if(month==2) {
117 str+="February ";
118 }
119 else if(month==3) {
120 str+="March ";
121 }
122 else if(month==4) {
123 str+="April ";
124 }
125 else if(month==5) {
126 str+="May ";
127 }
128 else if(month==6) {
129 str+="June ";
130 }
131 else if(month==7) {
132 str+="July ";
133 }
134 else if(month==8) {
135 str+="August ";
136 }
137 else if(month==9) {
138 str+="September ";
139 }
140 else if(month==10) {
141 str+="October ";
142 }
143 else if(month==11) {
144 str+="November ";
145 }
146 else {
147 str+="December ";
148 }
149 str+=day+","+year+" DDD YYYY: ";
150 str+=((month-1)*30+day)+" "+year;
151 return str;
152 }
153 }
154
155
156
157
For this programming assignment you will be re-using portions of your code from the last assignment as a starting point. You are to create a new DateFileTest class that uses the existing Date class for the following: Instead of bringing in dates from a user, you will be bringing in dates from a text file. You should use the existing Date class to create date objects from file inputs The data in the file is provided in alternating formats in order from MM/DD/YYYY to Month name, DD, YYYY (just those two formats to simplify the input handling and verification). Spaces are used in the file as delimiters between integers and strings in the date format. You will use the file provided here: dates in multiple formats.txt I . Your code is to handle exceptions for the following situations; the file is not found or can't be opened, in which case the program informs the user and ends. the month is not a valid month (between 1-12), using a try/catch block the year is not a valid year (assume between 1800-2020 is valid using a try/catch block) the entry is not a valid month name (must start with a capital and be spelled correctly as a string) If any of these exceptions occur, your program must disregard that specific date output an error message to the display, NOT write that specific date to the file, and continue to move on to process the rest of the data in the file Your program will create new text file and write dates out to that file. You will write out all 3 formats (with appropriate / and delimiters) to the file for each date read in from the file. Your program files must include a program header that includes your name, course discussion section, and program description. Well structured and commented code are expected. Your submission must include all program files, output text file, and execution screenshots showing your messages from error handling. Submissions without all the files will not receive a grade and no late submissions will be accepted. . inputs . The data in the file is dates in multiple forats (1).txt formats to simplify th Becom 1943 APROBAS 1985 127 2018 September 27 2005*12 13 2001 June 5 1875 11 25 1974 December 11 2004 21 1980 in the date format. Yo vo rings dates in multiple NOT Your code is to handle the file is not to the month is ne the year is not the entry is not If any of these except write that specific dat . Your program will cre delimiters) to the file Your program files m description. Well stru file, and execution ser a grade and no late submissions will be accepted. and text teive

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!