Question: 1. a basic program that performs simple file and mathematical operations. a. Using the file DateParser.java as starter code, program that reads dates from input,

1. a basic program that performs simple file and mathematical operations.

a. Using the fileDateParser.javaas starter code, program that reads dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use thesubstring()method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990. (20 points)

b.Afterthe program is working as above, modify the program so that it reads all dates from an input fileinputDates.txt(an Example file is part of the GitHub repository that you cloned). (10 points)

c. Modify your program further so that after parsing all dates from the input fileinputDates.txt, it writes out the correct ones into an output file called:parsedDates.txt. (10 points)

Ex: If the input is:

March 1, 1990 April 2 1995 7/15/20 December 13, 2003 -1 

then the output is:

3/1/1990 12/13/2003 

40 points total for problem 1

Commit the changes toDateParser.javainto the repository. Don't include the output file. We will use a different inout file for testing your code.

You get an additional 10 points if you make proper use of git by having multiple commits that show the evolution of your code over time so we can basically see your code at stages a., b. and c. (5 points). Make sure you modify the README file inside your repository describing the content (5 points). (seehttps://help.github.com/en/articles/about-readmesfor information about GitHub Readme files)

here is my code so far:

Can you please help me with the input display the date and show me how to do part B&C?

import java.util.Scanner; import java.util.ArrayList; public class DateParser { public static int getMont(String monthOfYear) { int monthNum; switch(monthOfYear) { case "January": monthNum = 01; break; case "February": monthNum = 02; break; case "March": monthNum = 03; break; case "April": monthNum = 04; break; case "May": monthNum = 05; break; case "June": monthNum = 06; break; case "July": monthNum = 07; break; case "August": monthNum = 8; break; case "September": monthNum = 9; break; case "October": monthNum = 10; break; case "November": monthNum = 11; break; case "December": monthNum = 12; break; default: monthNum = 0; break; } return monthNum; } public static void main(String[] args) { // TODO: Read dates from input, parse the dates to find the one // in the correct format, and output in mm/dd/yyyy format } 

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 Programming Questions!