
Concept explainers
Write a
Additional requirements:
- Header comments must be present
- Prototypes must be present if functions are used
- Hello and goodbye messages must be shown
- Use vector(s) for implementation
- Use comments and good style practices
HINT: Read the contents of the response file into an a vector. When the user enters a question, generate a random index and display the response from the vector with that index. Make sure to check for the exit condition.
To generate the random index, use the following in main() - this should be familiar by now...unsigned seed = time(0);
srand(seed);
Make sure to include all the necessary header files (cstdlib, ctime, vector, etc.).If you use the provided response file, download the attached text file and place in same location as your program.
If you create your own response file, make sure to place it in the same location as your program.
SAMPLE RUN:Welcome to the Magic 8-Ball program!Ask yes/no questions and the program will give you clarity about the outcome...Enter EXIT to exit the program.
Please ask your question: Will I get a good grade in this class?Without a doubt, yes.
Please ask your question: Does the professor know what he's talking about?I'll tell you after my nap.
Please ask your question: EXIT
Exiting program. Goodbye!
Language is C++
Please make it as simple as possible.

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

- Create an application that reads a sequence of up to 25 names and postal (ZIP) codes for persons. Put the data in an object that can have a first name (string), last name (string), and postal code (integer). Assume that each line of input will have two strings separated by a tab character, followed by an integer value. After the input has been read in, print the list to the screen in the appropriate manner.arrow_forwardCreate a class called StudentBirthYear. It should only have two members, both of them arrays. One of type string called Names. The second of type int called BirthYears. Now in your main class create a StudentBirthYear object. Make sure both arrays are of the size 13. Add thirteen different names and thirteen different birth years. Then display each name with its birth year using only 1 for loop. Only use a for loop, no other kind of loop.arrow_forwardwrite a program that reads the students.txt file and stores the name of the student and the grade information as a student object in an arraylist sorts the students names based on their first grade in decreasing order using the selection sort algorithm writes the sorted list as the students last name , middle name (if theres one), first name , and grade information into a text file output example: Robison, Lee 95 80 Green, Alex R 85 60 Waston, Zoe G 100 80 use javaarrow_forward
- Write a program called FiveLetterWords that: prints your name followed by three asterisks; reads the words in a text file into a String array, where each array entry contains a word; prints the number of words in the file; counts and prints the number of five-letter words; prints all of the five-letter words starting with a vowel (that is, 'a', 'e', 'i', 'o', or 'u'); finds and prints the alphabetically first five-letter word and the alphabetically last five-letter word. tale.txt file content : it was the best of times it was the worst of timesit was the age of wisdom it was the age of foolishnessit was the epoch of belief it was the epoch of incredulityit was the season of light it was the season of darknessit was the spring of hope it was the winter of despairarrow_forwardCreate a vector called x with values 0 thru 2π with an increment of pi/100 (suppress output to command window). Create another vector called y using 2*sin(x) (suppress output).arrow_forwardCreate a list of 5 words, phrases and company names commonly found in phishing messages. Assign a point value to each based on your estimate of its likelihood to be in a phishing message (e.g., one point if it's something likely, two points if modereratly, or three points if highly likely). Write an application that scans a file of text for these terms and phrases. For each occurance of a keyword or phrase within the text file, add the assigned point value to the total points for the number of occurences and the point total. Show the point total for the entire message. (Write the program in Java)arrow_forward
- Hello! I am having a problem trying to code a addNode method implementation to my program. I am trying to only get it to sort the lines alphabetically and then the categories will be sorted from the way it is first read in the input text file.So an input file would look like this: Name Clovis Bagwell Interesting The quick brown fox jumped over the lazy dog. Interesting Shake rattle and roll. Name Archibald Beechcroft and the output file should look like this: Name Archibald Beechcroft Clovis Bagwell Interesting Shake rattle and roll. The quick brown fox jumped over the lazy dog. My addNode code keeps organizing all of the categories and the lines in alphabetical order when categories is supposed to be organized by the way they are first read in the text file, and the lines under it are alphabetical.arrow_forwardCreate a class called CustomerListerwith a mainmethod that instantiates an array of Stringobjects called customerName. The array should have room for five Stringobjects. Use an initializer list to put the following names into the array:Cathy Ben Jorge Wanda FreddieUse newto create a second doublearray called customerBalancein the mainmethod. Allow room for five customer balances, each stored as a double.In the loop that prints each customer name, add some code to prompt the user to enter a balance for that customer. Read the keyboard input with a Scannerobject. Use the following balances for the input:100.00234.562.4932.32400.00After all the balances have been entered, print out each customer and his/her balance.arrow_forwardUpgrade the BankAccount class to store accounts in a vector called accountsVector. Create a static variable called count that stores the number of BankAccount objects created. Read data as before from the same file BankData.dat and create objects accordingly and store them in the vector. You may need to add or modify methods in your BankAccount class, as well as helper methods in your main class. Extend the BankAccount class to include a static int variable called count that stores the number of objects created. Note you will need to use the scope resolution operator :: to access this variable. BankAccount-string accountName // First and Last name of Account holder-int accountId // secret social security number-int accountNumber // integer -double accountBalance // current balance amount + static int count // number of objects created **+ BankAccount() //default constructor that sets name to "", account number to 0 and balance to 0+BankAccount(string accountName,int id, int…arrow_forward
- Don't use AI or chatgpt etc for answering!!!arrow_forwardA for construct is a loop that goes over a list of objects. Consequently, it runs indefinitely if there are items to process. What do you think about this?arrow_forwardCreate an ArrayList of strings to store the names of celebrities or athletes. Add five names to the list. Process the list with a for loop and the get() method to display the names, one name per line. Pass the list to a void method. Inside the method, Insert another name at index 2 and remove the name at index 4. Use a foreach loop to display the arraylist again, all names on one line separated by asterisks. After the method call in main, create an iterator for the arraylist and use it to display the list one more time.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





