The program below is the answer to Liang’s Introduction to Java Programming (9th Edition) Chapter 2 Exercise 2.4.
1 2 |
/**<br /> *<br /> * @Author: Aghatise Osazuwa<br /> * Website: www.cscprogrammingtutorials.com<br /> *<br /> * Exercise 2.4 - Convert Pounds To Kilograms<br /> *<br /> */ <br /><br />import java.util.Scanner;<br /><br />public class ConvertPoundsToKilograms {<br /> public static void main (String [] args) {<br /> Scanner input = new Scanner(System.in);<br /> System.out.println("This Program Converts A Number In Pounds To Kilograms.n");<br /> System.out.println("Enter a number in pounds: ");<br /> double pounds = input.nextDouble();<br /> double kilograms = pounds * 0.454;<br /> <br /> System.out.printf (pounds + " pounds is " + kilograms + " kilograms.n");<br /> }<br />} |
Click here to…