Problem

(Electrical eng.)a. Write, compile, and run a C++ program that calculates and displays the...

(Electrical eng.)

a. Write, compile, and run a C++ program that calculates and displays the value of the current flowing through an RC circuit (see Figure). The circuit consists of a battery connected in a series to a switch, a resistor, and a capacitor. When the switch is closed, the current, i, flowing through the circuit is given by this formula:

i = (E/R) e-t/RC

E is the voltage of the battery in volts.

R is the value of the resistor in ohms.

C is the value of the capacitor in farads.

t is the time in seconds after the switch is closed.

e is Euler’s number, which is 2.71828 (rounded to five decimal places). 

Figure: A series RC circuit

Using this formula, write, compile, and run a C++ program to determine the voltage across the capacitor shown in Figure 3.19 when t is 0.31 seconds. (Note: The value of RC is referred to as the system’s time constant.)

The program should prompt the user to enter appropriate values and use input statements to accept the data. In constructing the prompts, use statements such as “Enter the voltage of the battery.” Verify your program’s operation by calculating by hand the current for the following test data:

Test data set 1: Voltage = 20 volts, R = 10 ohms, RC = 0.044, t = 0.023 seconds

Test data set 2: Voltage = 35 volts, R = 10 ohms, RC = 0.16, t = 0.067 seconds


b. Check the value computed by your program by hand. After verifying that your program is working correctly, use it to complete the following chart:

Voltage V

(Volts)

Resistance R

(Ohms)

RC  (Time

Constant)

Time t

(Seconds)

Current i

(Amps)

35

10

0.16

0.11

 

35

10

0.16

0.44

 

35

10

0.16

0.83

 

15

10

0.55

0.11

 

15

10

0.55

0.44

 

15

10

0.55

0.067

 

6

1000

2.6

12.4

 

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 3
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT