Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please add comments for each step. Thanks you. Have you ever wanted to predict the future? Well the Magic Eight Ball does just that. The

image text in transcribed

image text in transcribed

image text in transcribed

please add comments for each step. Thanks you.

Have you ever wanted to predict the future? Well the Magic Eight Ball does just that. The original game was a softball sized "8-ball". You would ask a question, shake it up and look at the resuit. There are 20 responses... the ability to read in a set of responses, and add additional responses, and print out all of the responses in alphabetical order. Of course, we have to give seemingly accurate responses, which we will do by giving a random response. 10 positive, 5 negative, and 5 are vague. For this project, we want to recreate this, but give Program Details: You should have a menu with five lettered options. You should accept both capital and lower case letters in your menu options. The menu should do the task, then return to the menu (except in the case of exit). Any incorrect responses should get an error message, followed by a reprint of the menu a. Read responses from a file b. Play Magic Eight Ball c. Sort by responses d. Sort by and categories e. Write responses to a file f. Exit Each menu item must be implemented using a function or sets of functions with appropriate input parameters and return values. Functions will have a prototype in a file called functions.h and defined in a file called functions.cpp. Also, you will have a struct that keeps track of the response and whether it is positive, negative, or vague. That struct will also be in the functions.h file. Implementation Detail 1: Remember you will need to #include "functions.h" into both your main.cpp and functions.cpp but do not include.cpp files Implementation Detail 2: You should have an "duplicate guard" in your functions.h like: #ifndef FUNCTIONSH #define FUNCTIONS-H void readResponses(ifstream &infile, string responses! 1, string categories[ ], int &size ); - Pane 3 Have you ever wanted to predict the future? Well the Magic Eight Ball does just that. The original game was a softball sized "8-ball". You would ask a question, shake it up and look at the resuit. There are 20 responses... the ability to read in a set of responses, and add additional responses, and print out all of the responses in alphabetical order. Of course, we have to give seemingly accurate responses, which we will do by giving a random response. 10 positive, 5 negative, and 5 are vague. For this project, we want to recreate this, but give Program Details: You should have a menu with five lettered options. You should accept both capital and lower case letters in your menu options. The menu should do the task, then return to the menu (except in the case of exit). Any incorrect responses should get an error message, followed by a reprint of the menu a. Read responses from a file b. Play Magic Eight Ball c. Sort by responses d. Sort by and categories e. Write responses to a file f. Exit Each menu item must be implemented using a function or sets of functions with appropriate input parameters and return values. Functions will have a prototype in a file called functions.h and defined in a file called functions.cpp. Also, you will have a struct that keeps track of the response and whether it is positive, negative, or vague. That struct will also be in the functions.h file. Implementation Detail 1: Remember you will need to #include "functions.h" into both your main.cpp and functions.cpp but do not include.cpp files Implementation Detail 2: You should have an "duplicate guard" in your functions.h like: #ifndef FUNCTIONSH #define FUNCTIONS-H void readResponses(ifstream &infile, string responses! 1, string categories[ ], int &size ); - Pane 3

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago