Write a C++ program using object-oriented principles that will display the National Champion of NCAA College Football for the year the user enters. The valid years that may be entered are from 1998 - 2022. An input file - named NationalChampionship.txt - has been created that contains: the year and the school team that won the National Championship. It should be located in the current directory. To begin, the program should declare two arrays: one array to hold the year and another array to hold the school and team name. Populate the arrays with the values read in from the input file. Close the input file. Next, the program should prompt the user to enter a year. Validate the user's input value. If the user enters an invalid year, display an error message and let the user retry as many times as needed. When a good input year is entered, the program must find the corresponding year in the first array. Then, the program must look in the second array to find the name of the team that won the national championship for that year. Display that value. Continue to prompt the user for another year until the user wishes to stop. Make it clear how you would like for the user to stop. A sample output: National Championship Inquiry Reading the input file... Enter a year between 1998 - 2022 to find the champion (press -99 to stop): 2008 The Florida Gators were the National Champions in 2008. Enter a year between 1998 - 2022 to find the champion (press -99 to stop): -1999 Invalid input, try again: two thousand Invalid input, try again: tell me!!!! Invalid input, try again: 2016 The Clemson Tigers were the National Champions in 2016. Enter a year between 1998 - 2022 to find the champion (press -99 to stop): -99 New Year, New Team, One Dream! At a minimum, the class should have: private member variables: an array that holds the year an array to hold the school and team name the input file private member functions: file maintenance (opening the file, testing the file opened properly, reading the file, closing the file) display method public member functions: a constructor - if needed driver method main() should only contain the instantiated object of the class, a call to the driver method, a system pause command, and a return statement. Add comments. NOTE: Any submitted program that does not use OOP appropriately will result in a grade of 0. To Do: Upload your cpp file to the Project 7 Drop Box. Be sure to check the Rubrics before you submit your Project. Rubrics tell you exactly what must be included in each Project and how much each item is worth. Check the Calendar for the due date! Be sure to use the template code (the file called template code under Visual Studio in Modules).
Write a C++ program using object-oriented principles that will display the National Champion of NCAA College Football for the year the user enters. The valid years that may be entered are from 1998 - 2022.
An input file - named NationalChampionship.txt - has been created that contains: the year and the school team that won the National Championship. It should be located in the current directory.
To begin, the program should declare two arrays: one array to hold the year and another array to hold the school and team name.
Populate the arrays with the values read in from the input file. Close the input file.
Next, the program should prompt the user to enter a year. Validate the user's input value. If the user enters an invalid year, display an error message and let the user retry as many times as needed.
When a good input year is entered, the program must find the corresponding year in the first array. Then, the program must look in the second array to find the name of the team that won the national championship for that year. Display that value.
Continue to prompt the user for another year until the user wishes to stop. Make it clear how you would like for the user to stop.
A sample output:
National Championship Inquiry Reading the input file... Enter a year between 1998 - 2022 to find the champion (press -99 to stop): 2008 The Florida Gators were the National Champions in 2008. Enter a year between 1998 - 2022 to find the champion (press -99 to stop): -1999 Invalid input, try again: two thousand Invalid input, try again: tell me!!!! Invalid input, try again: 2016 The Clemson Tigers were the National Champions in 2016. Enter a year between 1998 - 2022 to find the champion (press -99 to stop): -99 New Year, New Team, One Dream! |
At a minimum, the class should have:
private member variables:
an array that holds the year
an array to hold the school and team name
the input file
private member functions:
file maintenance (opening the file, testing the file opened properly, reading the file, closing the file)
display method
public member functions:
a constructor - if needed
driver method
main() should only contain the instantiated object of the class, a call to the driver method, a system pause command, and a return statement. Add comments.
NOTE: Any submitted program that does not use OOP appropriately will result in a grade of 0.
To Do:
- Upload your cpp file to the Project 7 Drop Box.
- Be sure to check the Rubrics before you submit your Project. Rubrics tell you exactly what must be included in each Project and how much each item is worth.
- Check the Calendar for the due date!
- Be sure to use the template code (the file called template code under Visual Studio in Modules).
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images