Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#12 ASSIGNMENT Write that will calculate the voltage across each component of a

ID: 3835081 • Letter: #

Question

#12 ASSIGNMENT Write that will calculate the voltage across each component of a series program AC voltage resonant consisting of a resistor, capacitor, source. The program user is to input the value of the each component along with the applied frequency and source voltage. The equations are: 2nfL XL (X ITX ITR You should write and use just ONE function that takes frequency, resistance, and returns XL, Xc, and ZT (i.e. use pointers). Also use the following values for output submission. C uf, L 20mH, R 30 Ohms, f 796 Hz

Explanation / Answer

#include<iostream>
#include<math.h>
#define PI 3.14

using namespace std;

void calculateXLXCZT(
   float f, float R,
   float L, float C,
   float* XL,
   float* XC,
   float* ZT
)
{
   *XL = 2 * PI * f * L * pow (10,-3);
   *XC = 1.0 / (2 * PI * f * C) * pow(10,6);
   *ZT = sqrt(pow(*XL - *XC, 2) + pow(R, 2));
}

int main()
{
   float f, R, L, C;
   float XL, XC, ZT;
   float VS;
   cout << "Enter the f, R, L, C and VS";
   cin >> f >> R >> L >> C >> VS;
   calculateXLXCZT(f, R, L, C, &XL, &XC, &ZT);
   float IT = VS / ZT;
   float VL = IT * XL;
   float VC = IT * XC;
   float VR = IT * R;
   cout << "VL : " << VL << " VC :" << VC << " VR :" << VR;
}