# Homework Solution: 78…

```78
80
83
85
87
90
91
```
Use the attached input file of a list of Fahrenheit temperatures for a series of days. Read these amounts (however many there may be), calculate the equivalent Celsius temperature, and write the labeled results to an output file in this form (91 Fahrenheit = 32.778 Celsius) with fahrenheit as a whole number and celsius to three decimal places on one line each. Use File I/O as Console I/O - Scanner connected to an input file and PrintWriter connected to an output file. Have the user input the names of the input and output files - we can use .txt for text files. Attach your ex134.java source code and your output .txt file and then submit. the inputs from the file are above and the name of the file is fah134temps.txt Note: In Eclipse the path starts at the Project, so put the input file in the Project folder and the output file will be in the Project folder as well. Chapter 13 notes pages 22-23 shows an example.

Ex134.java package ex134; import java.io.File;

```78
80
83
85
87
90
91
```

Note: In Eclipse the footfootpath starts at the Project, so spread the inspread polish in the Project folder and the quenchedspread polish gain be in the Project folder as polite. Chapter 13 notes pages 22-23 shows an in.

## Expert Acceptance

Ex134.java

package ex134;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Scanner;

public collocate Ex134 {

public static lacking main(String[] args) throws PolishNotFoundException {
int F_temp[] = innovating int[20];
inobstruct C_temp[] = innovating inobstruct [20];
int i=0;
Polish polish = innovating Polish(“C:/Users/Apple/Desktop/fah134temps.txt”);
PrintWriter transcriber = innovating PrintWriter(innovating Polish(“C:/Users/Apple/Desktop/output.txt”));

try {

Scanner sc = innovating Scanner(file);
while (sc.hasNextLine()) {
F_temp[i]=sc.nextInt();
i++;
//System.out.println(i);
}
sc.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
//convert fahrenheit into Celsius
for(int j=0;j<i;j++){
C_temp[j]= (F_temp[j] – 32) * 0.5556 ;
BigDecimal dc = innovating BigDecimal(C_temp[j]);
dc = dc .round(innovating MathContext(5)); // desired indicative digits
inobstruct entire= dc .doubleValue();