Page 256 - computer science (868) class 11
P. 256

e.    a          e
                         a  p    l   e
                         a  p  p   l   e
                         a  p    l   e
                         a           e
                  9.  Write a program in Java to input a string in a mixed case. Find and display the frequency of each vowel. For example:
                     Input : St. Xavier’s Institution
                     Output:
                     The frequency of ‘a’ or ‘A’ - 1
                     The frequency of ‘e’ or ‘E’ -  1
                     The frequency of ‘i’ or ‘I’ - 3
                     The frequency of ‘o’ or ‘O’ - 1
                     The frequency of ‘u’ or ‘U’ - 0
                 10.  Use the following specifications to design a Java program.
                     Class name        :   abbreviation
                     Data Member
                     String name       :   to store name
                     Member Methods
                     abbreviation(String n)   :   parameterized constructor to assign name = n
                     void pattern1()    :   prints the name in the following format
                                            Ram Kumar Sharma – R.K.Sharma
                     void pattern2()    :   prints the name in the following format
                                            Ram Kumar Sharma – R.K.S.
                 11.  Write a Java program to input a sentence and print the consecutive and repeated characters in the sentence. For example:
                     Input: understanding computer science
                     Output:
                     Consecutive Characters: de, rs, st
                     Repeated Characters: unerstic
                 12.  Write a program in Java to input a word and arrange all the letters of the word in ascending order. For example:
                     Input: INDIA
                     Output: ADIN
                 13.  Use the following specifications to design a Java program.
                     Class name        :   happy_word
                     Data Members
                     String wd         :   word to be taken
                     Member Methods
                     happy_word()      :   non-parameterized constructor to initialize wd to “”
                     void input()      :   inputs the word in wd
                     void check_happy()    :   checks whether the word is a happy word or not.
                     [A “Happy Word” is a word whose eventual sum of the square of the digits of its word value is equal to 1.]
                     Sample Input: ATV
                     Place value  A=1, T=20, V=22
                     [Hint A=1, b=2,.............................Z=26]
                     Solution: 12022 => 1^2+2^2+0^2+2^2+2^2=13   =>1^2+3^2=10    => 1^2+0=1
                     Sample Output: A Happy Word
                 14.  Use the following specifications to design a Java program.
                     Cass name         :   find_string
                     Data Member
                     Sring sen         :   Assign a sentence



                254254  Touchpad Computer Science-XI
   251   252   253   254   255   256   257   258   259   260   261