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

Input: The program should prompt the user to enter the name of two binary files.

ID: 3540539 • Letter: I

Question

Input: The program should prompt the user to enter the name of two binary files. Each

file contains a series of double-precision values; one represents a series of resistance

values, while the other contains the corresponding voltage drop across those resistors.

Note that:

-If the user enters the name of a file that cannot be opened, print an error

message and repeat the prompt for the name.

- You may assume that each input file holds the same number of values, and that

number will be no more than 20.

- After reading each file name, the program should read the contents of the file into

an array that stores these values. Look at the output test files on the course web

page (r1v1_out.txt, r2v2_out.txt, r3v3_out.txt) to see a list of the

values in each input file.

- If an error occurs when reading a file, print an error message and exit the

program.

- Note that reaching the end of the file without reading the maximum

amount of data is not an error. If you attempt to read 10 values and only

get 5, for example, the remainder of the program should work strictly with

those 5 values.


The program should also prompt for the name of a file to store your output, which is

described below.


Output: After reading the input files, your program should print the following

information:

- A table of the resistance/voltage pairs read from the input files.

- Each quantity should be shown using 2 decimal places.

- You may assume the maximum resistance is 99,999.99 ohms.

- You may assume the minimum and maximum voltages are -99.99 and

99.99 volts, respectively.

- A separate table showing the minimum, maximum, and average values for three

quantities: the voltage drops, current flow, and power consumption across all

resistors. Note that:

- Voltage should be printed using 2 decimal places; current and power

should be printed using 4.

-You should calculate the current and power for each pair of R/V values

and store each number in an appropriate array. For example, if the

resistance, voltage, and current values are stored in arrays res[],

voltage[], and current[], then current[0] is based on res[0]

and voltage[0].

-To calculate current, use the equation I (current) = V / R

- To calculate power, use the equation P = V * I

- After filling the current and power arrays, you can find the minimum,

maximum, and average value in each array before printing.


I don't understand how to work with a program that uses files such as open and closing files.


test files to use : http://tinyurl.com/kzkyc6r


Example of Output:

http://img109.imageshack.us/img109/1751/u5ii.png

Input: The program should prompt the user to enter the name of two binary files. Each file contains a series of double-precision values; one represents a series of resistance values, while the other contains the corresponding voltage drop across those resistors. Note that: -If the user enters the name of a file that cannot be opened, print an error message and repeat the prompt for the name. You may assume that each input file holds the same number of values, and that number will be no more than 20. After reading each file name, the program should read the contents of the file into an array that stores these values. Look at the output test files on the course web page (r1v1_out.txt, r2v2_out.txt, r3v3_out.txt) to see a list of the values in each input file. If an error occurs when reading a file, print an error message and exit the program. Note that reaching the end of the file without reading the maximum amount of data is not an error. If you attempt to read 10 values and only get 5, for example, the remainder of the program should work strictly with those 5 values. The program should also prompt for the name of a file to store your output, which is described below. Output: After reading the input files, your program should print the following information: A table of the resistance/voltage pairs read from the input files. Each quantity should be shown using 2 decimal places. You may assume the maximum resistance is 99,999.99 ohms. You may assume the minimum and maximum voltages are -99.99 and 99.99 volts, respectively. A separate table showing the minimum, maximum, and average values for three quantities: the voltage drops, current flow, and power consumption across all resistors. Note that: Voltage should be printed using 2 decimal places; current and power should be printed using 4. -You should calculate the current and power for each pair of R/V values and store each number in an appropriate array. For example, if the resistance, voltage, and current values are stored in arrays res[], voltage[], and current[], then current[0] is based on res[0] and voltage[0]. -To calculate current, use the equation I (current) = V / R To calculate power, use the equation P = V * I After filling the current and power arrays, you can find the minimum, maximum, and average value in each array before printing. I don't understand how to work with a program that uses files such as open and closing files.

Explanation / Answer