Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.12 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 should put your .java file and your output text files into a single .zip file that you will submit to UTC Learn.
Some useful links:
BlueJ tutorial www.bluej.org/tutorial/tutorial-201.pdf
Java tutorial home page: http://docs.oracle.com/javase/tutorial/
Start here: http://docs.oracle.com/javase/tutorial/java/index.html
Arrays http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
Array Lists http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
Some helpful tips:
1) Compile often do it.
2) You are only responsible for creating a single class, CapacitorVoltage. You may put all your code into the main method. You will also need to create an output file, rc.txt.
3) 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.
4) There is no starter code for this lab. You should make sure that your code works with the given input file, and produces output to the output file rc.txt.
5) 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.
6) 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.
7) 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: new File("params.txt"). (Use rc.txt for your output).
Tasks: Follow the directions below to complete your lab assignment
For today's lab we will be completing Exercise P11.12 from the book page 561.
P11.12 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 , and C = 0.25 F. Consequently
v(t) = 12(1 e-0.008t)
where t has units of s. 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 s, 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.
To Turn In via UTC Learn
You should turn in 1 .ZIP file containing your java files and an output file rc.txt. 1 file should be uploaded to UTC Learn. IMPORTANT!!! You should name your file in the following manner. lastname-firstname-lab06.zip. So John Smith would submit smith-john-lab06.zip.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago