Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. CS162 Winter 2020 Program #3

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 isnt 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! CS162 Winter 2020 Program #3 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 with AI-Powered 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

Students also viewed these Databases questions