Question: Write a CH+ program to find and if possible correct the errors written in an input foe. The input file as shown below consists of

 Write a CH+ program to find and if possible correct the
errors written in an input foe. The input file as shown below

Write a CH+ program to find and if possible correct the errors written in an input foe. The input file as shown below consists of first and last names of people as well as their birthdates on each line: As you can see from the file, the day, month or year of the birthdate might be incorrectly entered. You are expected to discard the input if the day and year are incorrect, and try to correct the month. To correct the month, check the first 3 characters, if it matches one of the 12 months, correct it. For example, if "Sepsember" is entered, its first 3 characters match "September", 50 correct it accordingly. Output all the correcty entered or corrected inputs onto another file as shown below. Ali Yilmaz - August 3, 1999 . Ece Ozkan - September 15,2000 Output file Hakan Boz - October 23, 1998 Tolga Bal - April 22, 2002 Arda Tozan - January 12, 1998 in your program, implement the following classes using composition: Your main program should input each line from the input file, and using exception handling, check the day, month and year. If exceptions are thrown, in your first catch routine, output an error message if day or year is incorrect. In your second catch, try to correct the month according to the first 3 characters. If you can correct the month, output the corrected information onto the output file. A sample output of the catch routines will be as follows: Hints: 1. To check the first 3 characters of a string, you can use the substr () function in the string header file. st. substr(x,n) : returns n characters from the string st starting from position x. 2. To make your job easier, you may think about putting the 12 months into an array of strings

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!