Question: Please write the following program in Python 3 . Also, please note You are NOT permitted to use ANY global variables. And There is NO

Please write the following program in Python 3. Also, please note You are NOT permitted to use ANY global variables.

And

There is NO input or printing anywhere other than main.

----------

Please be as exact as possible.

Please write the following program in Python 3. Also, please note You

are NOT permitted to use ANY global variables. And There is NO

The following UML diagrams specify three classes. The RC_Filter class has a composition relationship with the Resistor and Capacitor classes. Your job is to implement these three classes as specified below. None of these three classes do ANY input or printing operations. You can NOT add any other members to these three classes Resiston - resistance: float - tolerance: float +__init__(float, float) + get_resistance() : float + set_resistance(float) + get_tolerance) float + set_tolerance(float) + getMin) float + getMax() : float strin Capacitor - capacitance: float - tolerance: float +__init__(float, float) + get capacitance () float + set_ capacitance (float) + get_tolerance) float + set_tolerance(float) + getMin) float + getMax) float string The init methods of these two classes set the values of the resistance, capacitance and tolerance according to the parameter values. The getMin methods return the value of the resistance or capacitance minus the tolerance amount. The tolerance is a percentage (ie. 5%), so the minimum is nominal * (1-tolerance/100). The getMax methods work like the getMin methods except they return the maximum resistance or capacitance which is nominal(1+tolerance/100). The repr method returns a formatted string containing the resistance and the tolerance values Note: the resistance, capacitance, and tolerance must be setup as properties with methods to set and get the property values. The set methods should raise a ValueError exception if the argument value is0 RC Filter + resistor: Resistor + capacitor: Capacitor +_init__(Resistor, Capacitor) + getNominalCutoff() : float + getMinCutoff() : float + getMaxCutoff(): float strin The RC Filter class init method has the following parameters: a Resistor obiect and a Capacitor object. These are stored as the member variables of the class. The getNominalCutoffmethod returns the filter's cutoff frequency using the nominal resistance and capacitance values. The formula for calculating cutoff frequency is 1 /(2 * pi * resistance * capacitance) The getMinCutoffmethod returns the minimum cutoff frequency which is calculated using the maximum resistance and capacitance values. The getMaxCutoffmethod returns the maximum cutoff frequency which is calculated using the minimum resistance and capacitance values. The repr method returns a string containing the resistance and capacitance information. The main function will ask the user to enter values for resistance, tolerance, and capacitance, tolerance. It will create Resistor and Capacitor objects, and an RC_Filter object. It will call the methods on the filter object to verify that the methods of all three classes are working correctly The following is sample output from running the program. Enter the resistance value: 1000 Enter the resistor tolerance: 10 Enter the capacitance value: .000001 Enter the capacitor tolerance: 10 Resistance: 1000.0 ohms Tolerance: 10.0% Capacitance: 0.000001 farads Tolerance: 10.0% Nominal Cutoff Frequency is 159.15 Hz Minimum Cutoff Frequency is 131.53 Hz Maximum Cutoff Frequency is 196.49 Hz The following UML diagrams specify three classes. The RC_Filter class has a composition relationship with the Resistor and Capacitor classes. Your job is to implement these three classes as specified below. None of these three classes do ANY input or printing operations. You can NOT add any other members to these three classes Resiston - resistance: float - tolerance: float +__init__(float, float) + get_resistance() : float + set_resistance(float) + get_tolerance) float + set_tolerance(float) + getMin) float + getMax() : float strin Capacitor - capacitance: float - tolerance: float +__init__(float, float) + get capacitance () float + set_ capacitance (float) + get_tolerance) float + set_tolerance(float) + getMin) float + getMax) float string The init methods of these two classes set the values of the resistance, capacitance and tolerance according to the parameter values. The getMin methods return the value of the resistance or capacitance minus the tolerance amount. The tolerance is a percentage (ie. 5%), so the minimum is nominal * (1-tolerance/100). The getMax methods work like the getMin methods except they return the maximum resistance or capacitance which is nominal(1+tolerance/100). The repr method returns a formatted string containing the resistance and the tolerance values Note: the resistance, capacitance, and tolerance must be setup as properties with methods to set and get the property values. The set methods should raise a ValueError exception if the argument value is0 RC Filter + resistor: Resistor + capacitor: Capacitor +_init__(Resistor, Capacitor) + getNominalCutoff() : float + getMinCutoff() : float + getMaxCutoff(): float strin The RC Filter class init method has the following parameters: a Resistor obiect and a Capacitor object. These are stored as the member variables of the class. The getNominalCutoffmethod returns the filter's cutoff frequency using the nominal resistance and capacitance values. The formula for calculating cutoff frequency is 1 /(2 * pi * resistance * capacitance) The getMinCutoffmethod returns the minimum cutoff frequency which is calculated using the maximum resistance and capacitance values. The getMaxCutoffmethod returns the maximum cutoff frequency which is calculated using the minimum resistance and capacitance values. The repr method returns a string containing the resistance and capacitance information. The main function will ask the user to enter values for resistance, tolerance, and capacitance, tolerance. It will create Resistor and Capacitor objects, and an RC_Filter object. It will call the methods on the filter object to verify that the methods of all three classes are working correctly The following is sample output from running the program. Enter the resistance value: 1000 Enter the resistor tolerance: 10 Enter the capacitance value: .000001 Enter the capacitor tolerance: 10 Resistance: 1000.0 ohms Tolerance: 10.0% Capacitance: 0.000001 farads Tolerance: 10.0% Nominal Cutoff Frequency is 159.15 Hz Minimum Cutoff Frequency is 131.53 Hz Maximum Cutoff Frequency is 196.49 Hz

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!