Question: In C++ please newanagram.cpp This program is a repeat of the anagram.cpp exercise you did in Lab 5, but with a twist: You will implement

In C++ please

In C++ please newanagram.cpp This program is a repeat of the anagram.cppexercise you did in Lab 5, but with a twist: You willimplement the program using a user-defined class called AString! If you recall,Lab 5's exercise was a program that determines if 2 strings areanagrams. An anagram is a word or phrase formed by rearranging theletters of a different word or phrase, for example, the letters in

newanagram.cpp This program is a repeat of the anagram.cpp exercise you did in Lab 5, but with a twist: You will implement the program using a user-defined class called AString! If you recall, Lab 5's exercise was a program that determines if 2 strings are anagrams. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, for example, the letters in the word listen can be re-arranged to spell silent". In this exercise, you have to define a class called AString. In this string you must declare: A member variable called StringValue of type string Two (2) constructors: one that will not take arguments and set the value of the member variable to an empty string and one that will take one argument to initialize the member variable. Member function getString Member functions cleanUp and countLetters. For all of the above, be very careful how you choose them to be private or public. Your program must also define a function called compareCounts that takes in 2 integer arrays and returns a Boolean value that says if the 2 arrays are equivalent in their values or not. Requirements 1. Be sure to utilize only techniques we've covered in lecture. Do not use "special" arrays or pointers, do not use vectors, do not use built-in sorting functions, etc. You will get zero points if you do. 2. You are given 3 skeleton programs: headers.h, functions.cpp, and newanagram.cpp. You must complete missing lines in all 3 files and submit all 3 as well. 3. The skeleton program newanagram.cpp has lines in it that must not change from what you are given. 4. In all 3 skeleton files, there are comments in there as guidelines to help you finish this exercise. You should read them carefully. 5. The member function getString should ask the user for an input (see examples below). The input can be a sentence containing space characters. The input is assigned to the member variable StringValue. 6. The member function cleanUp should clean up the variable StringValue by removing all non-alphabet characters in it and then transforming all the remaining to lower-case characters. 7. The member function countLetters takes 1 argument: an integer array of size 26. The function should count the frequency of occurrences of all the letters in StringValue and place that count in the integer array in the appropriate index (O is for a, 1 is for b, etc.) 8. The program function compareCounts takes 2 argument: 2 integer arrays each of size 26. The function should compare to see that the 2 arrays are the same. It returns a Boolean value of false if it is and true otherwise, as is implied by the statement in the skeleton file: bool badCount = compareCounts(cal, ca2); 9. There are 2 constructors as is evidenced by the way that the class objects are created in the main function in newanagram.cpp. A session should look like one of the following examples (including whitespace and formatting). You'll note the similarity to the exercise in Lab 5. $ .ewanagram Enter string value: Eleven plus two!! Enter string value: Twelve plus three The strings are not anagrams. $ .ewanagram Enter string value: Rats and Mice:) Enter string value: in cat's dream?! The strings are anagrams. You should test your program with multiple examples before you submit it. Make sure your outputs match the above. The strings printed by the program should include a newline at the end, but no other trailing whitespace (whitespace at the end of the line). newanagram.cpp newanagram.cpp No Selection 1 // YOUR NAME HERE 2 // 3 // IMPORTANT NOTE - PLEASE READ: 4 // The comments below and in the other files are guidelines to help you 5 // finish this program. You should remove them before you // submit this program. 7 8 9 // Put in the required set up instructions here (include statements, etc). 10 11 int main() 12 { 13 // Other than completing the missing function calls, 14 // per the comments below, 15 // DO NOT CHANGE ANY OF THE OTHER INSTRUCTIONS HERE! 16 // 17 // EVEN IF YOU PASS THE AUTOGRADER, YOU WILL GET A ZERO GRADE 18 // IF YOU CHANGE ANY OF THE LINES BELOW!!! 19 20 AString sentencei, sentence2("nothing"); 21 int ca1[26] = {0}, ca2[26]={0}; 22 23 // Call the member functions on each of 24 // these class objects that will: 25 // (a) get the string values 26 // (b) clean up the string values 27 // (c) create the array of letter counts 28 // See lab description for details. 29 30 bool badCount = compareCounts(cal, ca2); 31 if (badCount) { 32 cout functions.cpp C++ 3 functions.cpp > No Selection 1 \/ Place your member function and program function definitions here: 2 // 1. The 2 Constructors // 2. Accessor member function 4 // 3. Mutator member function #1 / 4. Mutator member function #2 6 // 5. Program function 7 // See lab description for details // 5 8 9 10 00 h headers.h 2 3 4 h headers.h) C AString 1. class AString { // You will need to declare: || 1. 2 constructors (see lab description for details) || 2. Three (3) member functions (see lab description for details) 5 // called getString, cleanUp, countLetters 6 // one of which is a accessor function, and 2 are mutator functions // 3. One member variable called StringValue // // IMPORTANT: Figure out first which go in public and which in private. 10 }; 11 12 // Declare the program function used in the main routine called compareCounts here: 13 // type compareCounts(arguments); 7 8 9 14 newanagram.cpp This program is a repeat of the anagram.cpp exercise you did in Lab 5, but with a twist: You will implement the program using a user-defined class called AString! If you recall, Lab 5's exercise was a program that determines if 2 strings are anagrams. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, for example, the letters in the word listen can be re-arranged to spell silent". In this exercise, you have to define a class called AString. In this string you must declare: A member variable called StringValue of type string Two (2) constructors: one that will not take arguments and set the value of the member variable to an empty string and one that will take one argument to initialize the member variable. Member function getString Member functions cleanUp and countLetters. For all of the above, be very careful how you choose them to be private or public. Your program must also define a function called compareCounts that takes in 2 integer arrays and returns a Boolean value that says if the 2 arrays are equivalent in their values or not. Requirements 1. Be sure to utilize only techniques we've covered in lecture. Do not use "special" arrays or pointers, do not use vectors, do not use built-in sorting functions, etc. You will get zero points if you do. 2. You are given 3 skeleton programs: headers.h, functions.cpp, and newanagram.cpp. You must complete missing lines in all 3 files and submit all 3 as well. 3. The skeleton program newanagram.cpp has lines in it that must not change from what you are given. 4. In all 3 skeleton files, there are comments in there as guidelines to help you finish this exercise. You should read them carefully. 5. The member function getString should ask the user for an input (see examples below). The input can be a sentence containing space characters. The input is assigned to the member variable StringValue. 6. The member function cleanUp should clean up the variable StringValue by removing all non-alphabet characters in it and then transforming all the remaining to lower-case characters. 7. The member function countLetters takes 1 argument: an integer array of size 26. The function should count the frequency of occurrences of all the letters in StringValue and place that count in the integer array in the appropriate index (O is for a, 1 is for b, etc.) 8. The program function compareCounts takes 2 argument: 2 integer arrays each of size 26. The function should compare to see that the 2 arrays are the same. It returns a Boolean value of false if it is and true otherwise, as is implied by the statement in the skeleton file: bool badCount = compareCounts(cal, ca2); 9. There are 2 constructors as is evidenced by the way that the class objects are created in the main function in newanagram.cpp. A session should look like one of the following examples (including whitespace and formatting). You'll note the similarity to the exercise in Lab 5. $ .ewanagram Enter string value: Eleven plus two!! Enter string value: Twelve plus three The strings are not anagrams. $ .ewanagram Enter string value: Rats and Mice:) Enter string value: in cat's dream?! The strings are anagrams. You should test your program with multiple examples before you submit it. Make sure your outputs match the above. The strings printed by the program should include a newline at the end, but no other trailing whitespace (whitespace at the end of the line). newanagram.cpp newanagram.cpp No Selection 1 // YOUR NAME HERE 2 // 3 // IMPORTANT NOTE - PLEASE READ: 4 // The comments below and in the other files are guidelines to help you 5 // finish this program. You should remove them before you // submit this program. 7 8 9 // Put in the required set up instructions here (include statements, etc). 10 11 int main() 12 { 13 // Other than completing the missing function calls, 14 // per the comments below, 15 // DO NOT CHANGE ANY OF THE OTHER INSTRUCTIONS HERE! 16 // 17 // EVEN IF YOU PASS THE AUTOGRADER, YOU WILL GET A ZERO GRADE 18 // IF YOU CHANGE ANY OF THE LINES BELOW!!! 19 20 AString sentencei, sentence2("nothing"); 21 int ca1[26] = {0}, ca2[26]={0}; 22 23 // Call the member functions on each of 24 // these class objects that will: 25 // (a) get the string values 26 // (b) clean up the string values 27 // (c) create the array of letter counts 28 // See lab description for details. 29 30 bool badCount = compareCounts(cal, ca2); 31 if (badCount) { 32 cout functions.cpp C++ 3 functions.cpp > No Selection 1 \/ Place your member function and program function definitions here: 2 // 1. The 2 Constructors // 2. Accessor member function 4 // 3. Mutator member function #1 / 4. Mutator member function #2 6 // 5. Program function 7 // See lab description for details // 5 8 9 10 00 h headers.h 2 3 4 h headers.h) C AString 1. class AString { // You will need to declare: || 1. 2 constructors (see lab description for details) || 2. Three (3) member functions (see lab description for details) 5 // called getString, cleanUp, countLetters 6 // one of which is a accessor function, and 2 are mutator functions // 3. One member variable called StringValue // // IMPORTANT: Figure out first which go in public and which in private. 10 }; 11 12 // Declare the program function used in the main routine called compareCounts here: 13 // type compareCounts(arguments); 7 8 9 14

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!