In: Computer Science
Write a java program to convert Celsius degrees to Fahrenheit degrees
the user enters degrees in Celsius and the program Coverts the input to Fahrenheit using the following formula
T(°F) = T(°C) × 1.8 + 32
submit the source code
Design
output
Load:
1. Design (Pseudocode )
2. Source file (Java file, make sure to include comments)
3. Output file (word or pdf or jpig file)
Pseudocode :
Input temperature in Celsius
Calculate Fahrenheit temperature as F = C x 1.8 + 32
Print the temperature in Fahrenheit
Code :
import java.util.Scanner;
public class HelloWorld
{
// main function
public static void main(String []args)
{
// make an object of Scanner class
Scanner sc = new Scanner(System.in);
// input temperature in Celsius
float C = sc.nextFloat();
// convert to fahrenheit
float F = C*1.8f + 32f;
// display the result
System.out.println("Temperature in Fahrenheit = "+F);
}
}