Page 325 - CA_Blue( J )_Class10
P. 325

Rs. 30001 to Rs. 40000   4%
                       More than Rs. 40000      6%
                       Then calculates the total increased price
                       void display()         :   Prints the data members in the following format:
                       Model Name             Original Price   Increased Amount   Total
                       ------                 ------        ------               ------
                    5.  Define the class Palindrome with the following specifications:
                       Data Members
                       String word            :  Original word
                       String revword         :  Reverse word
                       Methods
                       Palindrome()           :   Constructor
                       void input()           :  Inputs the word
                       boolean check()        :   Reverses the word and checks whether they are equal or not. If equal then returns true else false.
                       void display()         :   Invokes check() and print whether it is a palindrome or not.
                    6.  Write a program to find the new string after encoding it.
                       Class name             :  encode
                       Data Members
                       String word            :  Original word
                       String encodeword      :  Converted word
                       Methods
                       encode()               :  Non-parameterised constructor
                       encode(String w)       :  Assigns w to word
                       void convert()         :   Replaces and print each character of the word with the next character in the ASCII table.
                                                 If the character is Z then it will print A.
                    7.  Create a class Pronic with the following specifications:
                       Data Members
                       int n                  :  Number to check
                       Methods
                       Pronic()               :  Constructor to initialize n to 0
                       void input()           :  Inputs n from user
                       void check()           :   Checks whether the number is Pronic Number or not.
                       (A Pronic number is the product of the two consecutive numbers. For example, 12 = 3 x 4, 20=4 x 5 etc.)
                    8.  Write a program to calculate the sum of the following series:
                       sum = x/1  + x/2  + x/3 +x/4 + …..+ x/n n
                                        3
                                            4
                              2
                                   2
                       Class name             :  series
                       Data Members
                       double sum             :  sum of the series
                       double n               :  last term of the series
                       double x               :  Value to be taken
                       Methods
                       series()               :    Constructor to initialize the data members
                       series(double x1, doublen 1)   :   Constructor to assign x1 to x and n1 to n
                       void calculate()       :  Calculates the sum of the series
                       void display()         :  Prints the result
                    9.  Create a class pattern with the following specifications:
                       Data Members
                       int n                  :   Number of lines in the pattern
                       Methods
                       pattern()              :  Initializes n
                       void pattern1()        :  Prints the following pattern:
                                                1
                                                12
                                                123
                                                1234
                                                ...
                                                12345…n



                                                                                                                       323
                                                                                                         Constructors  323
   320   321   322   323   324   325   326   327   328   329   330