Question: For today's lab we will be completing Exercise P11.10 from the book. P11.10 After the switch in the figure below closes, (see book for figure),

For today's lab we will be completing Exercise P11.10 from the book.

P11.10 After the switch in the figure below closes, (see book for figure), the voltage (in volts) across the capacitor is represented by the equation

v(t) = B(1 - e-t/(RC))

Suppose the parameters of the electric circuit are B = 12 volts, R = 500 W, and C = 0.25 mF. Consequently

v(t) = 12(1 e-0.008t)

where t has units of ms. Read a file params.txt containing the values for B, R, C, and the starting and ending values for t. Write a file rc.txt of values for the time t and the corresponding capacitor voltage v(t), where t goes from the given starting value to the given ending value in 100 steps. In our example, if t goes from 0 to 1000 ms, the twelfth entry in the output file would be:

110.00 7.02261

Make sure that your program catches the FileNotFoundException that can occur if your input file params.txt cannot be found. Your program should catch this exception, and then prompt the user for a file name again until a valid file is entered.

IMPORTANT!! For this lab you simply need to create a CapacitorVoltage class that implements the main method in order to perform your file I/O. Make sure you use params.txt as your input file. Use rc.txt for your output file.

This is what the text files with the parameters should contain:

12.0 500.0 0.25 0.0 1000.0

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!