es, a raise_price method that accepts a percentage as an argument to increase the price by percentage a reduce_price method that accepts a percentage as an argument to reduce the price by percentage demonstrate the class in a program to create 2 instances
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write the code in python
Create a CellPhone class. It has 3 attributes: __manufact, __model, __retail_price. It also has the following methods:
- 3 Mutator methods to change the attributes,
- 3 Accessor methods to get the attributes,
- a raise_price method that accepts a percentage as an argument to increase the price by percentage
- a reduce_price method that accepts a percentage as an argument to reduce the price by percentage
demonstrate the class in a program to create 2 instances of CellPhone class, raise the price and reduce the price.
write the phone info to a file using pickle, and then read it from the file and display it on screen.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images