Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add the logic in order to work the form. Shoud implement exception handling import javax.swing. * ; public class BMICalculator { public static void main

Add the logic in order to work the form.
Shoud implement exception handling
import javax.swing.*;
public class BMICalculator {
public static void main(String[] args){
JFrame frame = new JFrame("BMI Calculator");
frame.setSize(300,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.add(panel);
placeComponents(panel);
frame.setVisible(true);
}
private static void placeComponents(JPanel panel){
panel.setLayout(null);
JLabel userLabel = new JLabel("BMI");
userLabel.setBounds(10,20,80,25);
panel.add(userLabel);
JLabel weightLabel = new JLabel("How many pounds you weight?");
weightLabel.setBounds(10,50,200,25);
panel.add(weightLabel);
JLabel heightLabel = new JLabel("What is your height in inches?");
heightLabel.setBounds(10,80,200,25);
panel.add(heightLabel);
JLabel bmiLabel = new JLabel("Your BMI is");
bmiLabel.setBounds(10,110,80,25);
panel.add(bmiLabel);
JLabel categoryLabel = new JLabel("(Obese)");
categoryLabel.setBounds(10,140,80,25);
panel.add(categoryLabel);
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions