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.

    Expert Answer

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

    78
    80
    83
    85
    87
    90
    91
    

    Manifestation the robust inspread polish of a inventory of Fahrenheit latitudes ce a course of days. Read these amounts (nevertheless abundant there may be), estimate the equipollent Celsius latitude, and transcribe the labeled results to an quenchedspread polish in this construct (91 Fahrenheit = 32.778 Celsius) with fahrenheit as a unimpaired compute and celsius to three decimal places on single cord each. Manifestation Polish I/O as Console I/O – Scanner conjoined to an inspread polish and PrintWriter conjoined to an quenchedspread polish. Have the manifestationr inspread the calls of the inspread and quenchedspread polishs – we can manifestation .txt ce citation polishs. Attach your ex134.java beginning code and your quenchedspread .txt polish and then succumb. the inputs from the polish are overhead and the call of the polish is fah134temps.txt

    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);
    //read from inspread polish
    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();

    //transcribe to quenchedspread polish
    writer.println(F_temp[j]+” Fahrenheit = “+round+” Celsius nn”);

    }
    writer.flush();
    writer.close();
    }

    }

    outspread polish:

    //ce past straining or any variation fascinate do comments.