Page 607 - ComputerScience_Class_11
P. 607

75          }
                   76

                   77          public static void main(String args[])
                   78          {
                   79              modify obj = new modify();

                   80              obj.readWord();

                   81              obj.fVowelConsonant();
                   82              obj.arrange();
                   83              obj.show();

                   84          }
                   85      }


                 The output of the preceding program is as follows:

                       BlueJ: Terminal Window - Java

                   Options

                  Enter the word: Computer
                  Frequency of vowels: 3
                  Frequency of consonants: 5
                  Original word: COMPUTER
                  Rearranged word: OUECMPTR



                   Program 21    A number is said to be a bouncy number if the digits of the number are unsorted.
                                 For example,
                                 22344    :   It is not a bouncy number because the digits are sorted in ascending order.
                                 774410   :   It is not a bouncy number because the digits are sorted in descending order.
                                 155349  :   It is a bouncy number because the digits are unsorted.
                                 A number below 100 can never be a bouncy number.
                                 Write a program in Java to accept a number. Check and display whether it is a bouncy number
                                 or not.

                   1       import java.util.*;
                   2       class BouncyNumber
                   3       {

                   4           public static void main(String args[])
                   5           {
                   6               int num,before,rem,temp;

                   7               boolean incre = true, decre = true;
                   8               Scanner in = new Scanner(System.in);

                   9               System.out.print("Enter a number: ");




                                                                                                Internal Assessment  605
   602   603   604   605   606   607   608   609   610   611   612