Write a CH program to read from an input filc, games, surnames, and university registration dates for the students. In y

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a CH program to read from an input filc, games, surnames, and university registration dates for the students. In y

Post by answerhappygod »

Write A Ch Program To Read From An Input Filc Games Surnames And University Registration Dates For The Students In Y 1
Write A Ch Program To Read From An Input Filc Games Surnames And University Registration Dates For The Students In Y 1 (29.52 KiB) Viewed 70 times
Write a CH program to read from an input filc, games, surnames, and university registration dates for the students. In your program, you should find the errors in the input file, then correct these errors. Your input file should include first time, last name, and registration date on each line Lapur fils Kobe Bryant 7 July 1997 Sue Bird 10 Janeury 1999 Lebron James 15 Octobr 2000 Katie Smith 7 November 4024 Tina Thompson 19 Jene 2010 Magic Johnson 43 September 2002 As seen from the input file (input.txt), the day, month, or year of the registration date might be incorrectly entered (Descard if the day or year is entered incorrectly as an input). You are expected 1o correct the mooth. To correct the month, check the first 3 characters, if it matches one of the 12 months, correct it. For example, if "Octobr" entered, its first 3 characters match "October", so corrott (Hint: You can use the substr() function to check the first 3 characters)

Output all the correct or corrected inputs to another file named as one txt) as shown below: Output Kobe Bryant 7 July 199? Sue Bird 10 January 1999 Lebron James 15 October 2000 Tina Thompson 19 Junc 2010 In your program, se gomposition to create two classes Date and Swaewr Date class has the following data members and functions: , hay titan gel month integer) year integer) A constructor function should make assignments using member initialization Student class as the following data members and functions: firstName(string) ►lastName (string) Dute registrationday a registrationday is an object with data type Dule class) A constructor to initialize the name and also send the day, mouth, and year to the constructor of the registrationday object. ► Set Month function that gets a string parameter Day() function that returns the day of the registrationdale Yen) function to retium the year of the registrationdale prin info) function, has to print the first me, last name, registrationdate day, month, and year of the student 2/3

In You should input cach line from the input file (input.txt) and using exception handling check the day, month and year. If exceptions are thrown, in your first catch output an error message if the day or car is incomst. In your second catch, try to correct the month according to the first 3 characters. If you can correct the meth, cutput the corrected information onto the output file. You have to ensure the simple run of catch as follows: Incorrectly inputted month: Janeary is corrected to January Incorrectly inputted month:Octobr is corrected to October Incorrectly input for day/year: 4024 Incorrectly inputted month: Jene Incorrectly input for day/year:43
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply