Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ATILIM UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING CMPE 2 2 5 OBJECT - ORIENTED PROGRAMMING HOMEWORK III Instructors: i dem Turhan Erhan G k ay Assistants:
ATILIM UNIVERSITY
DEPARTMENT OF COMPUTER ENGINEERING
CMPE OBJECTORIENTED PROGRAMMING
HOMEWORK III
Instructors: idem Turhan Erhan Gkay
Assistants: Gizem Altnay Glah Ata
Due Date: Dec. :
Write a C program to find and if possible correct the errors written in an input file. 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 characters, if it matches one of the months, correct it For example, if Sepsember is entered, its first characters match September so correct it accordingly. Output all the correcty entered or corrected inputs onto another file as shown below:
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 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:
To check the first characters of a string, you can use the substr function in the string header file.
stsubstrxn: returns n characters from the string st starting from position x
To make your job easier, you may think about putting the months into an array of strings.
IMPORTANT NOTES:
Cheating will NOT be tolerated. Special software will be used to verify if the submitted homework is your original work or copied from someonesomewhere else. If any case of cheating is detected, at any time, you will get ZERO from your homework.
You should upload your homework file to the Moodle system.
The name of your homework file should be StudentIDHwNumber.cpp for example: hwcpp
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started