The program below is the answer to Liang’s Introduction to Java Programming (9th Edition) Chapter 2 Exercise 2.1.
1 2 |
/**<br /> *<br /> * @Author: Aghatise Osazuwa<br /> * Website: www.cscprogrammingtutorials.com<br /> *<br /> * Exercise 2.1 - Convert Celsius To Fahrenheit<br /> *<br /> */ <br /><br />import java.util.Scanner;<br /><br />public class ConvertCelsiusToFahrenheit {<br /> public static void main (String [] args) {<br /> Scanner input = new Scanner(System.in);<br /> System.out.println("This Program Converts Degrees From Celcius To Fahrenheit.n");<br /> System.out.print("Enter Celcius Degree: ");<br /> double celcius = input.nextDouble();<br /> double fahrenheit = (9.0/5) * celcius + 32;<br /> System.out.println (celcius + " Celcius is " + fahrenheit + " Fahrenheit.");<br /> }<br />}<br /><br /> |
Click here to see other solutions to Introduction to Java Programming.
1 Comment
What would be the output once you run the program?