Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming. The purpose of the third program is to continue refining our use of functions and arguments in C++ and practice using arrays of characters,

image text in transcribedimage text in transcribedimage text in transcribed

Programming. The purpose of the third program is to continue refining our use of functions and arguments in C++ and practice using arrays of characters, arrays of structures, and external data files. This is directly related to what was is covered with Lab #5. Again, our goal is to create programs with a small functions where main delegates to a series of functions where the real work takes place. In this programming assignment, you are not allowed to use global variables. Limit your functions to no more than 30 statements of code (for executable statements... not counting variable definitions, blank lines, lines with just curly brackets, or comments). Program Assignment: One of the great things about living in Oregon is having access to all of the amazing outdoor activities that are available. In addition, by living in or near Portland, we have access to many cultural events that we might not have otherwise. What are your favorite activities? I love art museum and the Japanese Gardens. The zoo is also a great plan especially if you are a Poke' hunter. I know people that hike every day Forest Park and skiing is pretty easy if you are up for the drive and traffic! Your job for program #3 is build a program to help keep track of your favorite activities. You will want to keep track of the following information: a. The name of the activity (e.g., Snowboarding) b. Where it is located (e.g., Mt Hood) c. Time of year (e.g., Winter) d. Description (no more than 130 characters) e. Your thoughts on why it is your favorite and what you would recommend (no more than 200 characters) f. Supplies needed or special attire g. For some activities, they are only available for certain dates (such as ZooLights) It is expected that you will create a structure to hold the aforementioned items and store all of the information in memory using an array of structures. Make sure your array size is small enough to test but large enough to make sense. A large part of this assignment is the use of structs and arrays of structs. Therefore, your program will need to READ the information from the user, and store it in an array of structs. Then, once it has been read in allow the user to display all favorite activities (in the order read in). An extra function we want you to support is the ability to search the array for a particular activity (by its name) and display all of the information about that particular favorite activity. This is important! External Data Files: Another large piece of this assignment is to use external data files, so that the information isn't lost at the end of the program. With external data files, the information that you store in the files must be written in such a way that it is easy to read it back in. Your file should have between each of the above fields. Name it favorite.txt Your program will need to ask the user for their selection of what they want to do. Give them a choice of at least the following (Perform the above over and over until the user wants to quit): 1. Load from a file a. Read in an existing favorite activities and store it into your array of structures 2. Add a new item to the list a. Read in information from the user for something to add to the list. b. Append this information to the external data file 3. Search for a matching activity by its name to display all of the information about that activity 4. Display all 5. Quit Make sure to keep all files (.cpp and .txt) in your "current working directory" on linux as the grader will not be able to replicate your directory structure. And, include the data file when submitting your work into D2L. ***You are always welcome to do more! Really focus on making general purpose functions that can be re-used. And, get more practice with arrays of characters! Things you should know...as part of your program: 1. Make sure to prompt the user for any input requested. Make sure it is clear from your prompts what the user is expected to do. 2. You may not use any global variables in this program! 3. You may not use the string class - instead use arrays of characters. You are allowed to use the cstring library. 4. Make sure to use C++'s I/O (iostream library) for your input and output. 5. After each input operation, make sure to use cin.ignore to remove the delimiters! 6. With external data files, first read before checking for end of file: i. Read the first item ii. While (!infile.eof() 1. Process what was read 2. Read again (prime the pump!) Programming. The purpose of the third program is to continue refining our use of functions and arguments in C++ and practice using arrays of characters, arrays of structures, and external data files. This is directly related to what was is covered with Lab #5. Again, our goal is to create programs with a small functions where main delegates to a series of functions where the real work takes place. In this programming assignment, you are not allowed to use global variables. Limit your functions to no more than 30 statements of code (for executable statements... not counting variable definitions, blank lines, lines with just curly brackets, or comments). Program Assignment: One of the great things about living in Oregon is having access to all of the amazing outdoor activities that are available. In addition, by living in or near Portland, we have access to many cultural events that we might not have otherwise. What are your favorite activities? I love art museum and the Japanese Gardens. The zoo is also a great plan especially if you are a Poke' hunter. I know people that hike every day Forest Park and skiing is pretty easy if you are up for the drive and traffic! Your job for program #3 is build a program to help keep track of your favorite activities. You will want to keep track of the following information: a. The name of the activity (e.g., Snowboarding) b. Where it is located (e.g., Mt Hood) c. Time of year (e.g., Winter) d. Description (no more than 130 characters) e. Your thoughts on why it is your favorite and what you would recommend (no more than 200 characters) f. Supplies needed or special attire g. For some activities, they are only available for certain dates (such as ZooLights) It is expected that you will create a structure to hold the aforementioned items and store all of the information in memory using an array of structures. Make sure your array size is small enough to test but large enough to make sense. A large part of this assignment is the use of structs and arrays of structs. Therefore, your program will need to READ the information from the user, and store it in an array of structs. Then, once it has been read in allow the user to display all favorite activities (in the order read in). An extra function we want you to support is the ability to search the array for a particular activity (by its name) and display all of the information about that particular favorite activity. This is important! External Data Files: Another large piece of this assignment is to use external data files, so that the information isn't lost at the end of the program. With external data files, the information that you store in the files must be written in such a way that it is easy to read it back in. Your file should have between each of the above fields. Name it favorite.txt Your program will need to ask the user for their selection of what they want to do. Give them a choice of at least the following (Perform the above over and over until the user wants to quit): 1. Load from a file a. Read in an existing favorite activities and store it into your array of structures 2. Add a new item to the list a. Read in information from the user for something to add to the list. b. Append this information to the external data file 3. Search for a matching activity by its name to display all of the information about that activity 4. Display all 5. Quit Make sure to keep all files (.cpp and .txt) in your "current working directory" on linux as the grader will not be able to replicate your directory structure. And, include the data file when submitting your work into D2L. ***You are always welcome to do more! Really focus on making general purpose functions that can be re-used. And, get more practice with arrays of characters! Things you should know...as part of your program: 1. Make sure to prompt the user for any input requested. Make sure it is clear from your prompts what the user is expected to do. 2. You may not use any global variables in this program! 3. You may not use the string class - instead use arrays of characters. You are allowed to use the cstring library. 4. Make sure to use C++'s I/O (iostream library) for your input and output. 5. After each input operation, make sure to use cin.ignore to remove the delimiters! 6. With external data files, first read before checking for end of file: i. Read the first item ii. While (!infile.eof() 1. Process what was read 2. Read again (prime the pump!)

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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

List the four steps in the model for giving praise.

Answered: 1 week ago

Question

List the criteria for setting objectives.

Answered: 1 week ago

Question

Describe four content motivation theories.

Answered: 1 week ago