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

Member Methods
                        void accept()    :   Inputs a sentence
                        void vowel()     :   Prints those words that begin with vowels and end with consonants
                        void newsen()    :    Creates new sentences after removing those words that are found in the vowel() method
                    15.  Use the following specifications to design a Java program.
                        Class name       :   swap
                        Data Members
                        String sen       :   enters a sentence.
                        String nwsen     :   creates a new sentence
                        Member Methods
                        swap(String s)    :   assigns s to sen
                        void interchange()   :   interchanges the words as shown in the following example.
                        void display()    :   prints both the words
                        Input: God Is Great
                        Output: Great Is God
                    16.  Write a program in Java to enter a string in a mixed case. Arrange all the letters of the string such that all the upper case characters
                       are followed by the lower case characters.
                        Sample Input:   India Is A GREAT cOUNTRY
                        Sample Output:   IIAGREATOUNTRYndiasc
                    17.  Write a program in Java to accept a three-letter word. Display all the probable three-letter combinations such that no letter
                       should be repeated in the output within each combination.
                        Sample Input:   CAT
                        Sample Output:   CAT, ATC, TAC, TCA, CTA, ACT
                    18.  Write a program in Java to input a string in upper case and print the frequency of each character. For example:
                        INPUT: COMPUTER HARDWARE
                        OUTPUT:
                           Characters       Frequency
                           A                        2
                           C                        1
                          D           1
                           E                        2
                           H                        1
                           M                        1
                           O                        1
                           P                        1
                           R                        3
                           T                        1
                           U                        1
                           W          1
                    19.  Write a Java program to accept a string. Convert the string into upper case. Count and print the number of double letter sequences
                       that exist in the string.

                        Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE”
                        Sample Output: 4
                    20.  Write a Java program to initialise the seven Wonders of the World along with their locations in two different arrays. Search for a
                       country input by the user. If it is found, then display the name of the country along with its Wonder, otherwise display “Sorry not
                       found!”.
                        Seven Wonders: CHICHEN ITZA, CHRIST THE REDEEMER, TAJ MAHAL, GREAT WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
                        Locations: MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY





                                                                                                                       255
                                                                                                              Strings  255
   252   253   254   255   256   257   258   259   260   261   262