Execute
Save
Share
Share link
share
share
share
Team
Public Teams
Comments
0
Created By:
Guest
Title:
Title
Description
Edit
Copy Link
Login
Email *
Password *
Login
OR
Create Account
Screen Name *
Email *
Password *
Retype Password *
Team Access Code
Register
Public CodeBins
HELP
--Select Theme--
Ambiance
Blackboard
Cobalt
Eclipse
Elegant
Erlang-Dark
Lesser-Dark
Monokai
Neat
Night
Rubyblue
Vibrant-Ink
Xq-Dark
New CodeBin
CodeBins Versions
01/21/2017- V.1
Recent CodeBins
View All CodeBins
import javax.swing.JOptionPane; public class ChocolateBMICalc { public static void main(String[] args) { //JOptionPane.showConfirmDialog(null, // "Are you a male or female?", "choclate bar calculator", JOptionPane.Male_Female_OPTION); Object[] possibleValues = { "Male", "Female", }; Object selectedValue = JOptionPane.showInputDialog(null, "welcome to the chocloate bar calculator.\n" + "I will calculate the total number of bars\n" + "you need to eat inorder to maintain your weight.\n" + "\n" + "Are you a male or female?", "Choclate bar calculator", JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]); //Object male = selectedValue; // Object female = selectedValue; (test value I dont' know how to impliment String weightstring = JOptionPane.showInputDialog("Enter your weight in pounds:"); int weight = Integer.parseInt(weightstring); String heightstring = JOptionPane.showInputDialog("Enter your height in inches:"); int height = Integer.parseInt(heightstring); String agestring = JOptionPane.showInputDialog("Enter your age in years:"); int age = Integer.parseInt(agestring); double BMRfemale = 655 + (4.3 * weight) + (4.7 * height) - (4.7 * age); double chocloatefemale = BMRfemale / 230; double BMRmale = 66 + (6.3 * weight) + (12.9 * height) - (6.8 * age); double chocloatemale = BMRmale / 230; JOptionPane.showMessageDialog(null, "total number of Choclate bars you must consume\n" + "to maintain your weight:\n" + "For a female is:\n" + chocloatefemale + "\n" + "For a male is:\n" + chocloatemale); System.exit(0); } }
Bottom of Page
In Head
On Load
On Ready
Setting
Validate
Copy
Format
Setting
Validate
Copy
Format
No Doc Type
HTML5
HTML 4.01 Transitional
HTML 4.01 Strict
HTML 4.01 Frameset
XHTML 1.1
XHTML 1.0 Transitional
XHTML 1.0 Strict
XHTML 1.0 Frameset
Copy
Format
Download
×
Code Description
×
Difference of Versions
HTML
CSS
JS
×
JS Error
×
CSS Error
Errors
Warnings
×
JavaScript Setting
JS Libraries:
Chrome Frame 1.0.3
Dojo 1.8.0
Dojo 1.7.3
Dojo 1.7.2
Ext Core 3.1.0
jQuery 1.8.0
jQuery 1.7.2
jQuery 1.6.0
jQuery 1.5.0
jQuery 1.4.4
jQuery 1.4.0
jQuery-min 1.7.2
jQueryUI-min 1.8.21
MooTools more-1.4.0.1-full
MooTools core-1.4.5-full
MooTools core-1.4.1-full
Prototype 1.7.1.0
script.aculo.us 1.9.0
SWFObject 2.2
Twitter Bootstrap 2.0.4
WebFont Loader 1.0.28
yui 3.5.1
User Libraries:
Upload File
JavaScript URL(s):
×
CSS Setting
CSS Libraries:
jQueryUI 1.8.21
Twitter Bootstrap 2.0.4
User Libraries:
Upload File
CSS URL(s):