-4
\$\begingroup\$

my code is based on a form in a servlet, issue is with java the bmr is not returning the appropriate answer

double doubleweight = Double.parseDouble(Weight);
        double doubleage = Double.parseDouble(Age);
        double doubleheight = Double.parseDouble(Height);

        double BMRm, BMRf;
        BMRm = 66 + (6.3 * doubleweight) + (12.9 * doubleheight) - (6.8 * doubleage);
        BMRf = 655 + (4.3 * doubleweight) + (4.7 * doubleheight) - (4.7 * doubleage);

        double bmr = 0;

        if (Gender.equals("Female")){

            bmr=BMRf;
        }



        try (PrintWriter out = response.getWriter()) {
            /* TODO output your page here. You may use following sample code. */
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>"); 
            out.println(bmr);
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Servlet bmiservlet at " + request.getContextPath() + "</h1>");
            out.println("</body>");
            out.println("</html>");
        }
    }

first section of code is changing String parameter answers to doubles

\$\endgroup\$

closed as off-topic by 200_success, Mast, Hosch250, Sᴀᴍ Onᴇᴌᴀ, πάντα ῥεῖ Feb 8 at 16:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – 200_success, Mast, Hosch250, Sᴀᴍ Onᴇᴌᴀ, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed." \$\endgroup\$ – Sᴀᴍ Onᴇᴌᴀ Feb 8 at 16:14

Browse other questions tagged or ask your own question.