Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by tgeorge ( 6 years ago )
/**
* This program converts Pounds to Kilograms with the simple click of a button
*
* @tgeorge 10/2/20
*/
import java.util.Scanner;
public class MathFormula
{
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Welcome to Pounds to Kilogram converter");
System.out.println("Please enter a weight in Pounds :");
//This here above is just setting the scene nothing special
double pWeight = in.nextDouble();
//This gives a value to pounds which is saved by the code for future output
System.out.println("You entered " + pWeight + " pounds!");
System.out.println("Thats pretty hefty :/");
//Using the in.nextDouble line we can print out the users number whilst remembering it
//The lines here are just for some slander and clarification that we have the right number
double kWeight = (pWeight / 2.205);
//This is giving kilograms a value which is simply just pounds converted
System.out.println(pWeight + " pounds is the same as " + kWeight + " kilograms");
//This last line is just summing up your original input along with the desired conversion.
}
}
Revise this Paste