Question
In this lab we will implement a program that inputs data from a file, processes this data, and then writes new data into a new
In this lab we will implement a program that inputs data from a file, processes this data, and then writes new data into a new output file. This is problem P11.10 from the book. You do not need screen-shots for this lab. Simply include your output file. You will need to use WordPad (not notepad) or the Eclipse editor to view your output file. (Notepad will not correctly display new lines from your java output file). You may use BlueJ or Eclipse to complete the lab. (If you want to use some other IDE please talk to me about it). PLEASE COMMENT YOUR CODE. You will have points taken off if you do not comment your code. You can see sample comments in my starter code for how you should comment your code. Keep your code neat.
You should end up with one project folder that you will turn into a .zip file and submit to UTC Learn.
Some helpful tips:
Compile often do it.
You are only responsible for creating a single class, .You may put all of your code into the method. You will also need to create an output file, .
It may be helpful to use the Debugger or print statements to check your work. (always).You only need to submit a single output file, however I may test different inputs on your code.Feel free to do additional testing on your lab.
There is no starter code for this lab.You can download sample input from UTC Learn under the Lab section.
For eclipse, store your input files in the home directory for your Project.(This is one folder up from where your source files are stored).Your output will be written to this same location by default.If you place your file in the correct place, then you can simply refer to your file by name (no extra directories needed) in your code.
For BlueJ, store your input file in the home directory of your Project.(This is the same folder that contains your source files).Your output will be written to this same location by default.If you place your file in the correct place, then you can simply refer to your file by name (no extra directories needed) in your code.
Again, for step 5 or 6, if your file is placed in the correct folder, you can refer to the file name in the File constructor, like this:
Tasks: Follow the directions below to complete your lab assignment
For today's lab we will be completing Exercise P11.10 from the book.
Everything other than the exception handling must be finished during the lab period.
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 can not be found. You simply need to print a message from your catch block stating that the file was not found for this case and then exit your program (return).
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.
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