help today plz:(



Share on Google+Share on Google+

help today plz:(
1 Answer(s)      7 years ago
Posted in : Java Interview Questions
write a program that promptes the user to enter the weight of a package in pounds, and then outputs the weight of the backage in to kilograms
(one kilogram is approximately, 2.2 pounds)?
but i don't use "for" and import java.text.*;
View Answers

December 24, 2009 at 10:45 AM

Hi Friend,

Try the following code:

import java.util.*;
class Weight{
public static void main(String[] args){
Scanner input=new Scanner(;
System.out.println("Enter weight in pounds: ");
double w=input.nextDouble();
//2.2 pounds is equal to 1 kg.
double value=1/2.2;
double weightInKg=w*value;
System.out.println("Weight in Kg: "+weightInKg);