Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to find and correct the errors in an input file. As you can see below, the input file, input.txt consists of

Write a C++ program to find and correct the errors in an input file. As you can see below, the input file, input.txt consists of the names, surnames, and birthdates of the players. Input File Roger Federer 7 August 1993 Novak Djokovic 22 Sepsember 1987 Rafael Nadal 3 Febury 1986 Venus Williams 17 Decmber 1980 Naomi Osaka 6 Octber 1997 Maria Sharapova 19 Aprl 1987 Andre Agassi 22 April 1970 In the input file, if the months entered are incorrect, you have to check this situation by using Exception Handling, and you should 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 Aprl is entered, its first 3 characters match April, so correct it. (Hint: You can use the substr() function to check the first 3 characters) Create an output file named output.txt for all the correct or corrected inputs. Output File Roger Federer 7 August 1993 Novak Djokovic -- September 22, 1987 Rafael Nadal -- February 3, 1986 Venus Williams -- December 17, 1980 Naomi Osaka -- October 6, 1997 Maria Sharapova -- April 19, 1987 Andre Agassi -- April 22, 1970 Use composition to create two classes Date and Player. Use member initialization for the classes constructors assignments. printInfo() function, has to print the first name, last name, birthdate day, month, and year of the player. In the main function, Your program should input each line from the input file input.txt, and using Exception Handling, check the month. Create try-catch block for the month. You have to control the months writing and then if it is not correct you should print the incorrectly entered month on the screen. In short, if exceptions are thrown, for the 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. In your catch block, you should create an object from the Player class. image text in transcribed image text in transcribedimage text in transcribed

Write a C++ program to find and correct the errors in an input file. As you can see below, the input file, input.txt consists of the names, surnames, and birthdates of the players. In the input file, if the months entered are incorrect, you have to check this situation by using Exception Handling, and you should 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 "Aprl" is entered, its first 3 characters match "April", so correct it. (Hint: You can use the substr() function to check the first 3 characters) he main function, Your program should input each line from the input file input.txt, and using Exception Handling, check the month. Create try-catch block for the month. You have to control the month's writing and then if it is not correct you should print the incorrectly entered month on the screen. In short, if exceptions are thrown, for the 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. In your catch block, you should create an object from the Player class. A sample output of the catch routines will be as follows: Incorrectly inputted month:Sepsember is corrected to September Incorrectly inputted month:Febury is corrected to February Incorrectly inputted month:Decmber is corrected to December Incorrectly inputted month:Octber is corrected to October Incorrectly inputted month:Aprl is corrected to April Create an output file named output.txt for all the correct or corrected inputs. Use composition to create two classes Date and Player. Use member initialization for the classes' constructors assignments. printInfo() function, has to print the first name, last name, birthdate day, month, and year of the player

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 3 Lnai 9853

Authors: Bettina Berendt ,Bjorn Bringmann ,Elisa Fromont ,Gemma Garriga ,Pauli Miettinen ,Nikolaj Tatti ,Volker Tresp

1st Edition

3319461303, 978-3319461304

More Books

Students also viewed these Databases questions