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

Please help me to write this program. I can create the data file, that is no pro

ID: 3688846 • Letter: P

Question

Please help me to write this program. I can create the data file, that is no problem. Just not sure where to start with or how to set up the program. Thanks

Create a simple data file like the example shown below containing the 4 dates below plus 10 or more additional dates. The file should include 1 date per line and each date should have the form MonthNumber-DayOfTheMonth-Last2DigitsOfTheYear with no extra spaces. All dates should be in this century. No error checking for invalid dates is necessary.

2-19-15 7-4-14 11-4-17 9-30-16 Write a program that will read the dates in the input date file and create an output data file with the form Month DavOttheMontb, Year. An example is shown below February 19, 2015 July 4, 2014 November 4, 2017 September 30, 2016 th, Year, An example is shown below.

Explanation / Answer

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.File;
import java.io.FileWriter;
import java.io.BufferedWriter;
public class HelloWorld{
     public static void main(String []args){
       BufferedReader br = null;
       String token[];
        try {
           String sCurrentLine,content="";
           br = new BufferedReader(new FileReader("data.txt"));
           while ((sCurrentLine = br.readLine()) != null) {
                sCurrentLine="2-1-15";
           token=sCurrentLine.split("-");
            switch(Integer.parseInt(token[0]))
            {
                case 1: content="January";break;
                case 2: content="Febrary";break;
                case 3: content="March";break;
                case 4: content="April";break;
                case 5: content="May";break;
                case 6: content="June";break;
                case 7: content="July";break;
                case 8: content="August";break;
                case 9: content="September";break;
                case 10: content="October";break;
                case 11: content="November";break;
                case 12: content="December";break;
              
            }
            content+=" "+token[1]+" ,"+"20"+token[2];

               //System.out.println(content);
           File file = new File("output.txt");
           FileWriter fw = new FileWriter(file.getAbsoluteFile());
           BufferedWriter bw = new BufferedWriter(fw);
           bw.write(content);
           }

       } catch (IOException e) {
           e.printStackTrace();
       }
     }
}