Page 388 - Computer science 868 Class 12
P. 388

Design a class Rearrange using the description of the data members and member functions given below.
                     Class name                       :    Rearrange
                     Data Members/Instance variables
                     Txt                              :    to store a word
                     Cxt                              :    to store the rearranged word
                     len                              :    to store the length of the word
                     Member Functions
                     Rearrange ()                     :    constructor to initialise the instance variables
                     void readword ()                 :    to accept the word input in UPPERCASE
                     void convert ()                  :    to convert the word into its changed form and store it in string Cxt
                     void display()                   :    to display the original and the changed word
                     Specify the class Rearrange giving the details of the constructor (), void readword (), void convert () and void display (). Define a
                    main () function to create an object and call the functions accordingly to enable the task.   [ISC 2010]
                  5.  A class SortWord has been defined with the following details.
                     Class name                       :    SortWord
                     Data Members
                     txt                              :    to store the word
                     len                              :    to store the length of the word
                     Member Functions
                     SortWord()                       :    default constructor
                     void readTxt()                   :    to accept the word in lowercase
                     void sortTxt()                   :   to sort the word in  an  alphabetical  order  of characters  using  bubble  sort
                                                         technique and display it
                     void changeTxt()                 :    to change the case of vowels in the word to uppercase
                                                         For example, school becomes schOOl
                     void disp()                      :    to display the changed string
                     Specify the class SortWord giving the details of the constructor, void readTxt(), void sortTxt(), void changeTxt() and void disp(). You
                    need not write the main function.                                                          [ISC 2009]
                  6.  A class Mystring has been defined for the following methods.
                     Class name                       :    Mystring
                     Data Members
                     str                              :    to store a string
                     len                              :    to store the length of the given string
                     Member Functions
                     Mystring()                       :    constructor
                     void readstring()                :    reads the given string from input
                     int code(int index)              :    returns Unicode for character at position index
                     void word()                      :    displays the longest word in the string
                     Specify the class Mystring giving details of the constructor and void readstring(), int code(int index), void word() only. The main
                    function need not be written.                                                              [ISC 2007]
                    A class Check has been defined for the following methods.
                  7.  Class                           :    Check
                     Data Members
                     String st                        :    to store the string
                     int cap, small                   :    counters to store capital and small letters
                     int len                          :    to store the length of the string
                     Member Methods
                     Check(String)                    :    parameterised constructor to assign st




                386386  Touchpad Computer Science-XII
   383   384   385   386   387   388   389   390   391   392   393