
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();
}}}

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

- This is a Java programarrow_forwardWrite a Python program that reads each line of an input file workshop.txt that consists of a city name followed by a climate conditions like ( temperature, Humidity, Wind). The program will then decide whether it's possible to conduct a workshop in the city or not depending on the following conditions in sequence: • If temperature >20 and Humidity is not low then it's possible to conduct a workshop. If wind is normal and temperature is greater than 30 then it's possible to conduct a workshop. Save the results in a file called results.txt. For example, if the workshop.txt contains Muscat: 25, high, strong Suhar: 20, high normal Salalah: 15, low, normal The file results.xt. will contain Muscat: yes Suhar: no Salalah: noarrow_forwardWrite a java program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when tested, so too should the output file and the program must read the file line by line and write the file itselfarrow_forward
- Write a program that reads a file one character at a time and prints out how many characters are uppercase letters, lowercase letters, digits, white space, and something else. Characters.java 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.io.PrintWriter; 4 import java.util.Scanner; 5 6 public class Characters 7 { 8 public static void main(String[] args) throws FileNotFoundException { Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName int uppercase int lowercase 9 10 11 12 console.next( ); 0; 0; 0; = 0; 0; 13 %3D 14 %3D int digits int whitespace int other 15 16 17 %D 18 while (. { 19 .) 20 21 if (. else if (. else if (. else if (. else other++; 22 .) { uppercase++; } .) { lowercase++; } .) { digits++; } .) { whitespace++; } 23 24 25 26 27 } 28 System.out.println("Uppercase: System.out.println("Lowercase: System.out.println("Digits: System.out.println("Whitespace: System.out.println("0ther: } + uppercase); +…arrow_forwardWrite a Java program that reads from a URL and searches for a given word in the URL and creates a statistic file as an output. The statistic file needs to include some information from the URL. URL address Number of words in the URL page Number of repetitions for a given word displays the number of times the word appears. You need to have two functions, one for reading from the URL and the other function for searching the word.arrow_forwardUse python 3.5 Please define main and invoke it.arrow_forward
- Write a program (in C programming) cylinder.c that accomplishes the following: Read a list of radii and heights from a file(cylinder_input.data). For each pair of values, calculate the cylinder's volume and surface area. Display the results on the screen and save the results to a file. File: cylinder_input.data 1.5 10.2 2.21 20 3 30.243 55.23 2.2 12.1 45.989 The contents of the output file “cylinder_output.data” 1.500000 10.200000 72.099551 110.269902 2.210000 20.000000 306.877054 308.404496 3.000000 30.243000 855.100680 626.615787 55.230000 2.200000 21082.525775 19929.377237 12.100000 45.989000 21153.127133 4416.305811arrow_forwardWrite a program to handle a user's rolodex entries. (A rolodex is a system with tagged cards each representing a contact. It would contain a name, address, and phone number. In this day and age, it would probably have an email address as well.) Typical operations people want to do to a rolodex entry are: 1) Add entry 2) Edit entry 3) Delete entry 4) Find entry 5) Print all entries 6) Quit You can decide what the maximum number of rolodex entries is and how long each part of an entry is (name, address, etc.). When they choose to edit an entry, give them the option of selecting from the current rolodex entries or returning to the main menu — don't force them to edit someone just because they chose that option. Similarly for deleting an entry. Also don't forget that when deleting an entry, you must move all following entries down to fill in the gap. If they want to add an entry and the rolodex is full, offer them the choice to return to the main menu or select a person to overwrite. When…arrow_forwardWrite a Java program that opens a file and counts the whitespace-separated words in that file. You may obtain the name of the input file either from the command line or via prompt and user input. Be sure to clearly document the method chosen. You may test your program using any number of text files; however, you must be sure to test your program using the Sample Text File provided at the end (excerpt.txt). Sample Text File There was nothing so VERY remarkable in that; nor did Alice think it so VERY much out of the way to hear the Rabbit say to itself, `Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT- POCKET, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to…arrow_forward
- Write a high-security program in C that reads positive integers from a file "/challenge/numbers.txt" in the same directory as the program and outputs the biggest and smallest number. Input (from numbers.txt): 100 45 12 0 42 922 2 Output: 922 0arrow_forwardWrite a program that reads in from a file a starting month name, an ending month name, and then the monthly rainfall for each month during that period. As it does this, it should sum the rainfall amounts and then report the total rainfall and average rainfall for the period. For example, the output might look like this: During the months of March-June, the total rainfall was 7.32 inches and the average monthly rainfall was 1.83 inches. Data for the program can be found in the rainfall.txt file located in the Chapter 5 º programs folder on the book's companion website. Hint: After reading in the month names, you will need to read in rain amounts until the EOF is reached and count how many pieces of rain data you read in.arrow_forwardWrite a python program that will open the file dataFile.csv, read its contents and print them out. Your output should look like this: First Last Age Wagejane Smith 21.00 21.50Jack Jones 20.00 19.50Edgar Martinez 22.00 22.75Zanab Sayegh 21.00 21.75arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





