Question: Can you please write it down this code (below code) in a netbeans ide and send me a netbean ide files. File HealthProfile.java package bmiCalculator;

Can you please write it down this code (below code) in a netbeans ide and send me a netbean ide files.

File HealthProfile.java

package bmiCalculator;

public class HealthProfile { //Private variables to store name, age, height, weight and BMIs private static String name; private static int age; private static double height; private static double weight; private static double BMI; //setName() method to assign name to private variable name public void setName(String Name) { name=Name; } //setAge() method to assign age to private variable age public void setAge(int Age) { age=Age; } //setWeight() method to assign weight to private variable weight public void setWeight(double Weight) { weight=Weight; } //setHeight() method to assign height to private variable height public void setHeight(double feet, double inches) { height = (feet*12) + inches; } //method to return name public String getName() { return name; } //method to return weight public double getWeight() { return weight; } //method to return height public double getHeight() { return height; } //method to calculate BMI public double getBMI() { BMI = (weight*0.45)/Math.pow((height*0.025),2); return BMI; } //method to get BMI Category public String getCategory() { String BMICategory=""; //checking BMI's and accordingly assigning category if(BMI<18.5) BMICategory="Under-weight"; else if(BMI>=18.5 && weight<=24.9) BMICategory = "Normal"; else if(BMI>=25 && weight <= 29.9) BMICategory = "Overweight"; else if(BMI>=30) BMICategory = "Obese"; return BMICategory; } //method to return max. heart rate public int MaxHR() { return 200-age; } }

File Lab1Main.java

package bmiCalculator;

import java.util.Scanner;

public class Lab1Main { public static void main(String[] args) { String name=""; double weight=0; int age=0; double feet=0; double inches=0; Scanner input = new Scanner(System.in); //loop to take inputs while(!name.equals("X")) { System.out.print("Enter name or X to quit: "); name=input.next(); //checking if input name is X or not if(name.equals("X")||name.equals("x")) { System.out.println("Program exited successfully!"); System.exit(0); } System.out.print("Your age: "); age=input.nextInt(); System.out.print("Your weight: "); weight=input.nextDouble(); System.out.print("Your height - feet: "); feet = input.nextDouble(); System.out.print("Your height - inches: "); inches = input.nextDouble(); //creating object to HealthProfile class HealthProfile hp=new HealthProfile(); //calling methods of HealthProfile class hp.setName(name); hp.setWeight(weight); hp.setAge(age); hp.setHeight(feet, inches); //Displaying Output data to user System.out.print(" Health profile for: "+hp.getName()); System.out.printf(" BMI: %.1f",hp.getBMI()); System.out.print(" Category: "+hp.getCategory()); System.out.print(" Max heart rate: "+hp.MaxHR()+" "); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!