Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

GUI Applications

phillyluvr
phillyluvr 


Objectives Understand how to use the Java Foundation Classes (JFC) to create graphical user interfaces. Lab Assignment This lab assignment will ask you to write a program using the Java Foundation Classes. Exercise 1 Create a New Project named BMICalculator Create a GUI application where the user enters a height in feet and inches and a weight (three inputs) into text fields. The application should have a button that displays the user’s BMI when clicked. To calculate a person’s BMI, the formula is: BMI = (Weight in Pounds / (Height in inches x Height in inches ) ) x 703 Note: Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. According to the NIH, the categories for BMI are: Underweight = <18.5 Normal weight = 18.5–24.9 Overweight = 25–29.9 Obesity = BMI of 30 or greater Submit a document with the source code and sample output in Blackboard. Attachments Tags Clarifications

Answers

BMI

sudheer488
sudheer488 



Submitted along with the screenshot of the output Attachments
BMICalculator.rar (16 K) Download









Preview
overriding existing main targets. The targets of interest are: -init-macrodef-javac: defines macro for javac compilation -init-macrodef-junit: defines macro for junit execution -init-macrodef-debug: defines macro for class debugging -init-macrodef-java: defines macro for class execution -do-jar: JAR building run: execution of project -javadoc-build:

Preview
<mkdir dir="${build.test.results.dir}"/> <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> <customize> <customize2/> <jvmarg value="-ea"/> <arg line="${testng.debug.mode}"/> <arg line="-d ${build.test.results.dir}"/> <arg line="-listener org.testng.reporters.VerboseReporter"/> <arg line="${testng.cmd.args}"/> </customize> </j2seproject3:debug> </sequential> </macrodef> </target> <target depends="-init-macrodef-testng-debug" if="$

Preview
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <group>

Preview
<type>org.netbeans.modules.java.j2seproject</type> <configuration> <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> <name>BMICalculator</name> <source-roots>

Preview
(bmi < 18.5) { _bmiField.setText("Under Weight" + bmi); ; } else if (bmi < 25) { _bmiField.setText("Normal Weight" + bmi); ; } else if (bmi < 30) { _bmiField.setText("Over Weight" + bmi); ; } else { _bmiField.setText("Obesity" + bmi); } }

BMI Output.PNG (49 K) Download Preview

Screenshots
Screenshot
Purchase Answer

GUI BMI calculator

felo
felo 



Solution Attachments
BMICalculator.java (1 K) Download Preview
return (weight / (height * height))*703; }

BMICalculatorGUI.java (6 K) Download Preview
private JTextField getTextFieldCategory() { if (textFieldCategory == null) { textFieldCategory = new JTextField(); textFieldCategory.setHorizontalAlignment(SwingConstants.CENTER); textFieldCategory.setFont(new Font("Goudy Old Style", Font.BOLD, 13)); textFieldCategory.setEditable(false); textFieldCategory.setBounds(139, 163, 221, 20); textFieldCategory.setColumns(10); } return textFieldCategory; } private JButton getBtnFindOut() { if (btnFindOut == null)

BMI normal weight.png (133 K) Download Preview

underweight.png (124 K) Download Preview

obese.png (134 K) Download Preview

Screenshots
Screenshot
Screenshot
Screenshot
Purchase Answer