Q3 10 nts Arrays Write a program that converts Fahrenheit te

Q3 [10 nts] (Arrays) Write a program that converts Fahrenheit temperatures to Celsius and Kelvin. Read an integer n from the keyboard and then create an array of double values of size n. Read n values representing Fahrenheit temperatures from the keyboard and place them into the array. Display the Fahrenheit temperatures and its equivalent Celsius temperature and Kelvin temperatures in a tabular format. Use the following temperature conversion formulas: °C (F 32) x 5/9 OK °C 273.15

Solution

// Fahrenheit to Celsius conversion in Java

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

public class FahrenheitToCelsius

{

public static void main(String[] args) throws IOException

{

BufferedReader reader

= new BufferedReader(new InputStreamReader(System.in));

System.out.print(\"Please enter temperature in Fahrenheit : \");

double fahrenheit = Double.parseDouble(reader.readLine());

double celsius = (5.0/9.0)*(fahrenheit - 32);

System.out.println(\"Temperature in Celsius is : \"+celsius);

}

}

*****************************************************************************************

// Celsius to Fahrenheit conversion in Java

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

public class CelsiusToFahrenheit

{

public static void main(String[] args) throws IOException

{ BufferedReader reader

= new BufferedReader(new InputStreamReader(System.in));

System.out.print(\"Please enter temperature in Celsius : \");

double celsius = Double.parseDouble(reader.readLine());

double fahrenheit = (9.0/5.0)*celsius + 32;

System.out.println(\"Temperature in Fahrenheit is :

\"+fahrenheit);

}

}

// Fahrenheit to Celsius conversion in Java

 Q3 [10 nts] (Arrays) Write a program that converts Fahrenheit temperatures to Celsius and Kelvin. Read an integer n from the keyboard and then create an array
 Q3 [10 nts] (Arrays) Write a program that converts Fahrenheit temperatures to Celsius and Kelvin. Read an integer n from the keyboard and then create an array

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site