Using JSP language, create a system that calculates Body Mass Index (BMI) of users who entered their weight and height. Then, system will display all the records. Can you provide me the coding ?
Here is a jsp code that accepts the height and weight of the user and find the BMI.
<html> <form name="form" method="post" action="bmp.jsp"> <pre> Enter Weight: <input type="text" name="weight"> Enter Height: <input type="text" name="height"> <input type="submit" value="Find BMI"> </pre> </form> </html>
<% String wt=request.getParameter("weight"); String ht=request.getParameter("height"); int weight=Integer.parseInt(wt); int height=Integer.parseInt(ht); int w=weight*703; int h=height*height; int bmi = w/h; out.println("BMI of weight "+weight+" and height "+height+" is: "+bmi); %>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.