Page 290 - CA_Blue( J )_Class10
P. 290

10.  A person has taken a loan to buy a vehicle. He has to repay the loan according to the following criteria:
                    Time                   Rate of Interest
                    For 1 Year             4.5%
                    For 2 years            5%
                    For 3 years            7.5%
                    More than 4 years  10%
                    Class name        :  loan
                    Data members
                    int principal     :  Principal amount to be taken
                    int time          :  Time of repayment
                    double rate       :  rate of interest
                    Member Methods
                    void accept()     :   Inputs the principal and the time
                    double cal_interest()   :   Calculates the Simple Interest according to the above criteria and returns the interest.
                    void display()    :   Prints the principal and the Interest calculated.
                 11.  Define a class Automorphic with the following specifications:
                    Class name    :  Automorphic
                    Data Members
                    int n         :  Stores Number
                    int c         :   counter variable to store the number of digits.
                    Member methods
                    void accept()    :   Accepts the number to be checked
                    int count()   :   returns the number of digits
                    void display()   :   Checks and displays whether it is an Automorphic Number or not. (An automorphic number is a number whose
                                    square "ends" in the same digits as the number itself. For example, 5  = 25, 6  = 36) int count() is called from display().
                                                                                    2
                                                                                          2
                 12.  Write a program to create a class palindrome to print the palindromic numbers between m and n. (A palindrome is a number
                    whose reverse is equal to the number)
                    Class name           :  palindrome
                    Data Members
                    int m,n              :   m and n is the upper and lower limit of the range
                    Member Methods
                    void accept(int a, int b)   :  Assigns a to m and b to n
                    void display()         :   Prints all the Palindromic numbers from m to n.
                 13.  Write a program to define a class quadratic with the following specifications
                    Data Members
                                                                 2
                    double a, b, c    :   real numbers in the equation ax +bx+c=0
                    double r1, r2     :  roots of the equation
                    double d          :  determinant
                    Member Methods
                    void accept()     :  Accepts a,b and c
                    void determinant()   :  Calculates the determinant
                    void root()       :   calculates and displays the root if possible else prints a suitable message
                 14.  Write a program to create a class reverse_string with the following specifications
                    Class name    :  reverse_string
                    Data Members
                    String str    :  Sentence to be reversed
                    String rstr   :  reversed sentence
                    Member Methods
                    void accept()   :  Accepts the sentence
                    void change()   :    Reverses the sentence and stores in rstr.
                    void show()   :   Prints both the sentences
                 15.  Define a class word with the following data members and member methods
                    Class name    :   word
                    Data Members
                    String w      :  Accepts the word
                    int vc        :   Stores the number of vowels in the word
                    int cc        :   Stores the number of consonants in the word

                288288  Touchpad Computer Applications-X
   285   286   287   288   289   290   291   292   293   294   295