I am new in Java. I have to write a program that accept a person weight and display the number of Calories the person need in one day. A person needs 19 calories per pound of body weight, so the formula expressed in java is calories= bodyweight*19. Use JOptionPane claas method for input and output.
Here is my trial
import java.swing.*;
class HumanEnergy;
{
public static void main(String args[]);
{
float body_weight,calories;
String body_weight;
body_weight= JOptionPane.showInputDialog(“What is your body weight to be converted to Calories?”);
Change chan
body_weight=chan.nextFloat();
calories=body_weight*19;
body_weight= JOptionPane.showMessageDialog(null,”Your calories is”+calories);
}
}
}
Juma 0 Newbie Poster
jasimp 427 Senior Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.