This repository contains an exercise on Object-Oriented Programming (OOP) implemented in Python. The exercise focuses on practicing OOP concepts and principles to solve a specific problem.
The exercise involves creating an example of a Python class called "TV" that demonstrates concepts of object-oriented programming, such as encapsulation (using private attributes), accessor and mutator methods (getters and setters), and the use of exceptions for parameter validation.
The exercise utilizes the following technologies:
- Python: A versatile programming language known for its simplicity and readability.
To use the TV class, follow these steps:
- Instantiate an object of the TV class by providing the tamanho parameter.
- Use the various methods available to control the TV's volume, change channels, and turn the TV on or off.
- Retrieve the current channel and volume settings using the getter methods.
Instantiate the TV object:
const tv = new TV(42);
Increase the volume:
tv.aumentar_volume();
Change the channel:
tv.modificar_canal(5);
Get the current channel and volume:
const currentChannel = tv.get_canal();
const currentVolume = tv.get_volume();
Print the current channel and volume:
console.log(`Channel: ${currentChannel}`);
console.log(`Volume: ${currentVolume}`);
This will output:
Channel: 5
Volume: 51
Feel free to explore and experiment with the TV class to simulate the behavior of a television.
Contributions are what make the open-source community a fantastic place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the project.
- Create a branch for your feature (git checkout -b feature/AmazingFeature).
- Commit your changes (git commit -m 'Add some amazing feature').
- Push to the branch (git push origin feature/AmazingFeature).
- Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
Bruno Souza - bmsouza88@gmail.com
Project Link: https://github.com/BrunoSouza88/POO_Python-Exercise