B02C-2015 – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12A-2015-B02C #PYTHON#6355    siteicon   siteicon  

Problem Statement - B02C-2015

Write a class PHOTO in Python with following specifications:
Instance Attributes

-Pno       # Numeric value
-Category  # String value
-Exhibit   # Exhibition Gallery with String value
Methods:
-FixExhibit()  # A method to assign Exhibition
               # Gallery as per Category as
               # shown in the following table
Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida
Register()  # A function to allow user
            # to enter values of Pno, Category
            # and call FixExhibit() method
ViewAll{)   # A function to display all the data
            # members

Solution

TC++ #6355

class PHOTO:
    Pno=0
    Category=" "
    Exhibit=" "
    def FixExhibit():
        if self.Category=="Antique":
            self.Exhibit="Zaveri"
        elif self.Category=="Modern":
            self.Exhibit="Johnsen"
        elif self.Category=="Classic":
            self.Exhibit="Terenida"
    def Register():
        self.Pno=int(input("Enter Pno:"))
        self.Category=input("Enter Name:")
        self.FixExhibit()
    def ViewAll()
       print self.Pno,self.Category,self.Exhibit


Share

CSKC| Created: 11-Jan-2019 | Updated: 11-Jan-2019|CBSE12A-2015









Back