Page 604 - ComputerScience_Class_11
P. 604

57               Scanner sc = new Scanner(System.in);
                58               System.out.print("Enter a number: ");

                59               int input = sc.nextInt();
                60               Emirp e = new Emirp(input);

                61               e.isEmirp();
                62           }

                63       }

              The output of the preceding program is as follows:

                     BlueJ: Terminal Window - Java
                 Options

                Enter a number: 13
                13 is an Emirp number.



                Program 20     A class modify has been defined to modify a word by bringing all the vowels in the word at
                               the beginning followed by the consonants.
                               Example: ORIGINAL becomes OIIARGNL
                               Some of the members of the class are given below.
                               Class name             :   modify
                               Data members/Instance variables
                               word                   :   to store a word
                               nwWord                 :   to store the rearranged word
                               Member functions/Methods
                               modify()               :   default constructor
                               void readWord()        :   to accept the word

                               void fVowelConsonant()  :   finds the frequency of vowels and consonants in the
                                                         word and displays them with an appropriate message
                               void arrange()         :   rearranges the word by bringing the vowels at the beginning
                                                         followed by consonants
                               void show()            :   displays the original word along with the rearranged word
                               Specify  the  class  Rearrange, giving  details  of the  constructor, void  readWord(),  void
                               ffVowelConsonant(), void arrange() and void show(). Define the main() function to create an
                               object and call the functions accordingly to enable the task.

                 1       import java.util.*;
                 2       class modify

                 3       {
                 4           String word,nwWord;

                 5           modify()
                 6           {




                  602  Touchpad Computer Science (Ver. 3.0)-XI
   599   600   601   602   603   604   605   606   607   608   609