PLEASE READ THE QUESTION TILL THE END AND SOLVE THIS PYTHON PROBLEM…
Question Answered step-by-step PLEASE READ THE QUESTION TILL THE END AND SOLVE THIS PYTHON PROBLEM… PLEASE READ THE QUESTION TILL THE END AND SOLVE THIS PYTHON PROBLEM Background An electrical/electronic circuit is composed of different components, like, power supply unit/battery, resistor(s), inductor(s), capacitors, and other active components, like, diodes, transistors, etc. In most cases, the components have 2 terminals (end nodes) but can have 3 terminals (like a transistor) or multiple terminals (e.g., an IC).To make a circuit, each component is connected to other components/ground in a certain fashionGoal In this project, we are going to create class/sub-classes to represent different circuit components using object oriented programming feature available in Python.The main takeaway is the understanding that Python is a flexible language in which we can define our own custom objects, whose functionality and features can be shared with other similar objects.Project Description In this project, we are going to model and implement different circuit Components. A circuit behaves differently based on how the components are connected (even if the circuit components are the same). However, we are not focusing on the circuit itself. Rather, we are going to create different types of components. At the end of the project, you will be able to calculate the total cost of the components of a given circuit though.Steps: Create a base class Component with object attributes id (unique for each component), name, n_terminals (number of terminals), and price (price of the component); and a class attribute count (to keep track of total number of components in a circuit).Inherit a class Resistor from Component class with the following feature:a Resistor always have 2 terminalsInherit a class Transistor from Component class with the following feature:a Transistor always have 3 terminalsAll these class must implement __init__, __str__ and optionaly __repr__ methods.Instead of accessing the member variables, you need to implement respective methods to get those values.The above classes should be in the circuit modulerespective docstrings should be included (module level, class level and method level)In another file (__main__ module), you will create a list of at least 4 different components (mix of both Resistor and Transistor) for a cicuit and print the cost of individual components (along with their names) and the total cost of the components all in a single file. Computer Science Engineering & Technology Python Programming CSCA 2000 Share QuestionEmailCopy link Comments (0)


