A program that Java to ask the user to give weight in pounds and it will convert into kilograms values.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
import java.util.*;
import java.text.DecimalFormat;
public class Pounds_Kilograms {
private static final DecimalFormat df = new DecimalFormat("0.00");
public static void main(String [ ] args) {
Scanner input = new Scanner (System.in);
int pounds=0;
double kilograms=0.00;
char c;
do{
System.out.println("\n");
System.out.println("\tPounds To Kilograms in Java");
System.out.println("\n");
System.out.print("\tGive Weight in Pound(s) : ");
pounds= input.nextInt();
// Convert into Kilograms here
kilograms = pounds * 0.453592;
System.out.println();
System.out.println("\tThe weight in kilogram(s) : " + df.format(kilograms));
System.out.println();
System.out.print("\tDo you want to continue? Y/N : ");
c = input. next(). charAt(0);
}while(c=='Y'|| c=='y');
System.out.println();
System.out.println("\tEnd of Program");
System.out.println();
input.close();
}
}
No comments:
Post a Comment