Java Program to Convert Kilogram to Pound and Pound to Kilogram

In the previous article, we have discussed about Java Program to Convert Kilogram to Ounce and Ounce to Kilogram

In this article we will see how to convert Kilogram to Pound and Pound to Kilogram by using Java programming language.

Java Program to Convert Kilogram to Pound and Pound to Kilogram

Before jumping into the program let’s know the relationship between Kilogram and Pound and how we can convert Kilogram to Pound and vice versa.

Generally Kilogram and Pound are used as unit in case of mass/weight measurement.

1 Kilogram =  2.20462 Pound
1 Pound = 0.453592 Kilogram

Formula to convert Kilogram to Pound.

Pound  = Kilogram * 2.20462

Formula to convert Pound to Kilogram.

Kilogram  = Pound * 0.453592

Let’s see different ways to convert Kilogram to Pound and Pound to Kilogram.

Method-1: Java Program to Convert Kilogram to Pound and Pound to Kilogram By Using Static Input Value

Approach:

  • Declare Kilogram and Pound value.
  • Then convert Kilogram to Pound and Pound to Kilogram by using the formula.
  • Print result.

Program:

import java.util.*;
public class Main 
{
   public static void main(String args[])
   {
        //Scanner class object created
        Scanner sc=new Scanner(System.in);
        //value of kilogram declared
        double kilogram = 1;
        //value of pound declared
        double pound = 1;

        //converting kilogram to pound
        double p = kilogram * 2.20462;
        //converting pound to kilogram
        double kg = pound * 0.453592;
        //printing result
        System.out.println("Value of "+kilogram+" kilogram in pound: "+ p);   
        System.out.println("Value of "+pound+" pound in kilogram: "+ kg);   
   }
}
Output:

Value of 1.0 kilogram in pound: 2.20462
Value of 1.0 pound in kilogram: 0.453592

Method-2: Java Program to Convert Kilogram to Pound and Pound to Kilogram By Using User Input Value

Approach:

  • Take user input of Kilogram and Pound value.
  • Then convert Kilogram to Pound and Pound to Kilogram by using the formula.
  • Print result.

Program:

import java.util.*;
public class Main 
{
   public static void main(String args[])
   {
        //Scanner class object created
        Scanner sc=new Scanner(System.in);
        //Taking the value input of double variable kilogram
        System.out.println("Enter value of kilogram: ");  
        double kilogram = sc.nextDouble();
        //Taking the value input of double variable pound
        System.out.println("Enter value of pound: ");  
        double pound = sc.nextDouble();

        //converting kilogram to pound
        double p = kilogram * 2.20462;
        //converting pound to kilogram
        double kg = pound * 0.453592;
        //printing result
        System.out.println("Value of "+kilogram+" kilogram in pound: "+ p);   
        System.out.println("Value of "+pound+" pound in kilogram: "+ kg);   
   }
}
Output:

Enter value of kilogram: 
20
Enter value of pound: 
20
Value of 20.0 kilogram in pound: 44.0924
Value of 20.0 pound in kilogram: 9.07184

Method-3: Java Program to Convert Kilogram to Pound and Pound to Kilogram By Using User Defined Method

Approach:

  • Take user input of Kilogram and Pound value.
  • Call a user defined method by passing Kilogram and Pound value as parameter.
  • Inside method convert Kilogram to Pound and Pound to Kilogram by using the formula.
  • Print result.

Program:

import java.util.*;
public class Main 
{
   public static void main(String args[])
   {
        //Scanner class object created
        Scanner sc=new Scanner(System.in);
        //Taking the value input of double variable kilogram
        System.out.println("Enter value of kilogram: ");  
        double kilogram = sc.nextDouble();
        //Taking the value input of double variable pound
        System.out.println("Enter value of pound: ");  
        double pound = sc.nextDouble();
        //calling user defined method convert()
        convert(kilogram, pound);
   }
   
   //convert() method to convert kilogram to ounce and vice versa
   public static void convert(double kilogram, double pound)
   {
        //converting kilogram to pound
        double p = kilogram * 2.20462;
        //converting pound to kilogram
        double kg = pound * 0.453592;
        //printing result
        System.out.println("Value of "+kilogram+" kilogram in pound: "+ p);   
        System.out.println("Value of "+pound+" pound in kilogram: "+ kg);   
   }
}
Output:

Enter value of kilogram: 
5
Enter value of pound: 
2
Value of 5.0 kilogram in pound: 11.0231
Value of 2.0 pound in kilogram: 0.907184

Beginners and experienced programmers can rely on these Best Java Programs Examples and code various basic and complex logics in the Java programming language with ease.

Answer these:

  1. Write a program that converts pounds into kilograms python?
  2. Kilograms to pounds?
  3. Online java compiler?
  4. Write a java program to compute body mass index bmi?
  5. Write a program that calculates bmi implement for both client and server?
  6. 1 pound kg in india?
  7. Kilograms to pounds?
  8. Online java compiler?
  9. Body mass index by codechum admin?
  10. Amrit is a new intern at doselect?
  11. 1 pound = kg in india?
  12. write a program that converts pounds into kilograms python?
  13. Java program to convert kilogram to pound and pound to kilogram?

Related Java Programs: