Write a program, reading the temperature data from an input file, translating them to another temperature scale by the choice of user (F2C, C2F, K2C, C2K, K2F, F2K) and writing the calculated temperature values in output file. it is input file and output file java code . i am giving you the code you need to implement the code with I/O file import java.util.Scanner; public class Lab15{    public static void main(String[] args) {               Scanner Keyboard = new Scanner(System.in);       double Frahenhite, Celsius, Kelvin ; int input = 1; while (input==1) { for (int i = 1; i<=2; i++) {        System.out.println("Choose an option");        System.out.println("FTC - Fahrenheit to Celsius");        System.out.println("CTF - Celsius to Fahrenheit");        System.out.println("FTK - Fahrenheit to Kelvin");        System.out.println("KTF - Kelvin to Fahrenheit");        System.out.println("CTK - Celsius to Kelvin");        System.out.println("KTC - Kelvin to Celsius");            System.out.println("\nEnter Choice: ");     String Type= Keyboard.nextLine(); if (Type.equalsIgnoreCase("FTC"))     { System.out.println("Enter the value of temperature in Fahrenheit degrees: "); Frahenhite = Keyboard.nextDouble(); Celsius= ((5*(Frahenhite-32))/9) ;          System.out.println("The value of the temperature in Celsius = " + Celsius);     }    else if (Type.equalsIgnoreCase("CTF"))     {    System.out.println("Enter the value of temperature in Celsius degrees: ");     Celsius = Keyboard.nextDouble();    Frahenhite = ((9*Celsius)/5)+32;             System.out.println("The value of the temperature in Farhenhite = " + Frahenhite);     }    else if(Type.equalsIgnoreCase("CTK"))     {      System.out.println("Enter the value of temperature in Celsius degrees: ");     Celsius = Keyboard.nextDouble();    Kelvin = Celsius +273 ;         System.out.println("The value of the temperature in Kelvin = " + Kelvin);    }    else if(Type.equalsIgnoreCase("KTC"))     {      System.out.println("Enter the value of temperature in Kelvin degrees: ");    Kelvin = Keyboard.nextDouble();    Celsius = Kelvin - 273 ;         System.out.println("The value of the temperature in Celsius = " + Celsius);    } else if(Type.equalsIgnoreCase("FTK"))     {      System.out.println("Enter the value of temperature in Frahenhite degrees: ");    Frahenhite = Keyboard.nextDouble();    Kelvin =(5.0/9)*(Frahenhite - 32) + 273;;         System.out.println("The value of the temperature in Kelvin = " + Kelvin);    } else if(Type.equalsIgnoreCase("KTF"))     {      System.out.println("Enter the value of temperature in Kelvin degrees: ");    Kelvin = Keyboard.nextDouble();     Frahenhite =(9.0/5)*( Kelvin - 273) + 32;         System.out.println("The value of the temperature in Frahenhite = " + Frahenhite); }    } System.out.println("End of series "); System.out.println("If you want to convert again enter 1 or enter any other number to exit the code "); input = Keyboard.nextInt(); }}}

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program, reading the temperature data from an input file, translating them to another temperature scale by the choice of user (F2C, C2F, K2C, C2K, K2F, F2K) and writing the calculated temperature values in output file.

it is input file and output file java code . i am giving you the code you need to implement the code with I/O file

import java.util.Scanner;

public class Lab15{

   public static void main(String[] args) {
      
       Scanner Keyboard = new Scanner(System.in);

      double Frahenhite, Celsius, Kelvin ;

int input = 1;
while (input==1)
{
for (int i = 1; i<=2; i++) {
       System.out.println("Choose an option");
       System.out.println("FTC - Fahrenheit to Celsius");
       System.out.println("CTF - Celsius to Fahrenheit");
       System.out.println("FTK - Fahrenheit to Kelvin");
       System.out.println("KTF - Kelvin to Fahrenheit");
       System.out.println("CTK - Celsius to Kelvin");
       System.out.println("KTC - Kelvin to Celsius");
   
       System.out.println("\nEnter Choice: ");

    String Type= Keyboard.nextLine();

if (Type.equalsIgnoreCase("FTC"))
    {
System.out.println("Enter the value of temperature in Fahrenheit degrees: ");

Frahenhite = Keyboard.nextDouble();
Celsius= ((5*(Frahenhite-32))/9) ;         
System.out.println("The value of the temperature in Celsius = " + Celsius);
    }
   else if (Type.equalsIgnoreCase("CTF"))
    {

   System.out.println("Enter the value of temperature in Celsius degrees: ");


    Celsius = Keyboard.nextDouble();


   Frahenhite = ((9*Celsius)/5)+32;         

   System.out.println("The value of the temperature in Farhenhite = " + Frahenhite);



    }
   else if(Type.equalsIgnoreCase("CTK"))
    {
     System.out.println("Enter the value of temperature in Celsius degrees: ");


    Celsius = Keyboard.nextDouble();


   Kelvin = Celsius +273 ;     

   System.out.println("The value of the temperature in Kelvin = " + Kelvin);

   }

   else if(Type.equalsIgnoreCase("KTC"))
    {
     System.out.println("Enter the value of temperature in Kelvin degrees: ");


   Kelvin = Keyboard.nextDouble();


   Celsius = Kelvin - 273 ;     

   System.out.println("The value of the temperature in Celsius = " + Celsius);
   }

else if(Type.equalsIgnoreCase("FTK"))
    {
     System.out.println("Enter the value of temperature in Frahenhite degrees: ");


   Frahenhite = Keyboard.nextDouble();


   Kelvin =(5.0/9)*(Frahenhite - 32) + 273;;     

   System.out.println("The value of the temperature in Kelvin = " + Kelvin);
   }

else if(Type.equalsIgnoreCase("KTF"))
    {
     System.out.println("Enter the value of temperature in Kelvin degrees: ");


   Kelvin = Keyboard.nextDouble();


    Frahenhite =(9.0/5)*( Kelvin - 273) + 32;     

   System.out.println("The value of the temperature in Frahenhite = " + Frahenhite);
}


   }
System.out.println("End of series ");
System.out.println("If you want to convert again enter 1 or enter any other number to exit the code ");
input = Keyboard.nextInt();
}}}

.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education