The problem
Write a program that converts pounds into kilograms. The program prompts the user to enter a number in pounds, converts it to kilograms, and displays the result. One pound is 0.454 kilograms. Below is a representation of a sample run:
Breaking it down
Asking the user to input a number in pounds then storing it to a double pounds
will get us started. Next passing the value to a method named poundsToKilos
will perform the conversion. Finally outputting the value to the console will satisfy the requirements. Did you try to input a character? If so, what happened? If you were writing production level code, you would want to validate user input as a secure software best practice, give it a try!