Assignment: 1- Create a class called Book with the following attributes: 1. title: The title of the book. 2. author: The author of the book. 3. pages: The number of pages in the book. Use a constructor (__init___) to initialize these attributes when creating an object from the class. Add a method inside the class calle description() which returns a description of the book Lec 3: Classes and Objects Object-oriented programming 2- Create a class called Phone with the following attributes: 1. brand: The brand of the phone. 2. price: The price of the phone. Use a constructor (__init__) to initialize these attributes when creating an object from the class. Add a method inside the class called show_info(), which prints the phone's details
Assignment: 1- Create a class called Book with the following attributes: 1. title: The title of the book. 2. author: The author of the book. 3. pages: The number of pages in the book. Use a constructor (__init___) to initialize these attributes when creating an object from the class. Add a method inside the class calle description() which returns a description of the book Lec 3: Classes and Objects Object-oriented programming 2- Create a class called Phone with the following attributes: 1. brand: The brand of the phone. 2. price: The price of the phone. Use a constructor (__init__) to initialize these attributes when creating an object from the class. Add a method inside the class called show_info(), which prints the phone's details
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 9PE
Related questions
Question

Transcribed Image Text:Assignment:
1- Create a class called Book with the following attributes:
1. title: The title of the book.
2. author: The author of the book.
3. pages: The number of pages in the book.
Use a constructor (__init___) to initialize these attributes when creating an object
from the class. Add a method inside the class calle description() which returns a
description of the book
Lec 3: Classes and Objects
Object-oriented programming
2- Create a class called Phone with the following attributes:
1. brand: The brand of the phone.
2. price: The price of the phone.
Use a constructor (__init__) to initialize these attributes when creating an object
from the class. Add a method inside the class called show_info(), which prints the
phone's details
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning