Page 334 - C++
P. 334

(i)     What  is  the  difference  between  the  variable  in  Line  2  and
                           Line 4 in the above Python code ?





                   (ii)    Write the output of the above Python code.







           (c)     Define  a  class  CONTAINER  in  Python  with  the  following
                   specifications :                                                                4


                   Instance Attributes
                   - Radius,Height  # Radius and Height of Container

                   - Type                   # Type of Container
                   - Volume                 # Volume of Container


                   Methods

                   - CalVolume()            # To calculate volume
                                            # as per the Type of container

                                            # With the formula as given below :

                     Type                    Formula to calculate Volume


                     1                       3.14 * Radius * Height


                     3                       3.14 * Radius * Height/3



                   - GetValue()             # To allow user to enter values of
                                            # Radius, Height and Type.

                                            # Also, this method should call
                                            # CalVolume() to calculate Volume

                   - ShowContainer()  # To display Radius, Height, Type
                                            # Volume of the Container



      91                                            15                                        P.T.O.
   329   330   331   332   333   334   335   336   337   338   339