Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructors: i clem Turhan - Erhan G k ay Assistants: Gizem Alt nay - G l ah Ata Due Date: Dec. 2 4 , 2

Instructors: iclem Turhan - Erhan Gkay
Assistants: Gizem Altnay - Glah Ata
Due Date: Dec. 24,2023,23:59
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:
Ali Yilmaz 3 August 1999
Ece Ozkan 15 Sepsember 2000
Hakan Boz 23 Octoer 1998
Selin Kurt 11 December 3001
Tolga Bal 22 Aprik 2002
Arda Tozan 12 Janaary 1998
Cem Kara 16 Jaly 2001
Irem Kar 39 February 2000
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", so correct it accordingly.
Output all the correcty entered or corrected inputs onto another file as shown below:
longrightarrow Output file
sample output of the catch routines will be as follows:
Incorrectly inputted month:Octoer
Incorrect input for day/year:3001
Incorrectly inputted month:Aprik is corrected to April
Incorrectly inputted month:Janas
Incorrectly inputted month: Jaly
Process exited after 0.1323 seconds with return value
Press any key to continue. ..
Hints:
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.
To make your job easier, you may think about putting the 12 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 someone/somewhere 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 "StudentID_HwNumber.cpp", for example:
"11122233_hw3.cpp"
In your program, implement the following classes using composition:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions