Question
The Reactance, X, of a series reactive AC circuit is calculated as a sum of reactance values for each individual circuit element in the series:
The Reactance, X, of a series reactive AC circuit is calculated as a sum of reactance values for each individual circuit element in the series:
x=x1+x2+....xn
(5.1)
Elements of the reactive AC circuit can be a capacitor or an inductor.
At the operating frequency f, the capacitive reactance Xc for a capacitor C (in microF) is calculated using the formula:
Xc=1/2pie . f .C.10^-6
(5.2)
At the same frequency, inductive reactance, XLfor an inductor L (in H) is calculated using the formula:
XL=2pie . f .L
(5.3)
Write a C++ code using the following specifications:
allow users to enter the frequency (f in Hz)
write a function called Capacitance that receives values for f and C, and returns to the main() the value for Xc, calculated using Equation (5.2)
write a function called Inductance that receives values for f and L, and returns to the main() the value for XL, calculated using Equation (5.3)
allow users to enter the number of elements they need (N)
Calculate the total reactance as an accumulative sum of reactance values for each of N elements, as described in Equation (4.1), using the following procedure:
for each element in the circuit, ask the user whether the element is a capacitor or an inductor,
when a capacitor is selected, call the Capacitance function described in step 2) above; the value of Xc received from the function has to be added to the total reactance value X
when an inductor is selected, call the Inductance function described in step 3) above; the value of XL received from the function has to be added to the total reactance value X
Once the values for all N elements are entered, print on the screen the calculated total value for X.
Use value 3.14159 for constant .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started