Date :
QUESTION 13
A class MyString contains a sentence where each word is separated by single blank space and maximum
of 80 words in the sentence. Some of the member of the class MyString are given below:
Class name : MyString
Data members/instance variables :
str: to store a sentence.
arr[] : string array to store words of the sentence.
len : integer to store the size of the array.
newStr : to store the new sentence.
Member functions/methods :
MyString(): default constructor to assign data members with initial values.
void Accept() : to accept a sentence in 'str' from input.
void fillArray : Using string tokenizer and its associated functions extract each
word from 'str and store them in the array arr).
void Arrange(): sorts the string array arr[] in Ascending order using any standard
sorting technique (ie. Selection, Bubble, or Insertion Sort).
Form a new sentence of sorted words in new Str.
void Show(): to print the original sentence, new sorted sentence, largest word
and smallest word.
(a) Specify the class MyString giving the details of the constructor and void Accept(), void fillArray(),
void Arrange() and void show(). Define a main() function to create object and call the methods
accordingly.
(b) State the role StringTokenizer and its functions countTokens() and nextToken() along with return
types.
Answers
Answered by
0
Answer:
I didn't understand this one ☝. I'm sorry
Similar questions