Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using jGrasp and the Software Development Kit, write a program in response to th

ID: 3556787 • Letter: U

Question

Using jGrasp and the Software Development Kit, write a program in response to the following prompt: Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds. Output both the mass and the weight rounded to two decimal places. (Note that for standard Earth gravity, 1 kilogram = 2.2 pounds.) Format your output with two decimal places.

Your answer should use dialog boxes for the input/output statements.

This question has been asked before, but the answers are not what I need. For one it must be in a dialog box. I have the entire code written...but not in the dialog box.

Explanation / Answer

import java.util.Scanner; // Scanner is in java.util

/**

* The MassConversionTool class implements and application

* that converts pounds to kilograms.

* @author Kevin Mirus

*

*/

public class MassConversionTool

{

              /**

              * Gets user input for a mass in pounds, then

              * converts that to kilograms.

              * @param args

              */

              public static void main(String args[])

              {

                            System.out.println("This program converts pounds to kilograms.");

                           

                            double number_of_pounds;

                           

                            Scanner keyboard = new Scanner(System.in);

                           

                            System.out.println("Enter a mass in pounds: ");

                            number_of_pounds = keyboard.nextDouble();

                           

                            double number_of_kilograms;

                           

                            number_of_kilograms = number_of_pounds / 2.204;

                           

                            System.out.println(number_of_pounds + " pounds = " +

                                                        number_of_kilograms + " kilograms");

              }//end method main(String[])

}//end class MassConversionTool

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote