This code defines a Patient class with private name, height, and weight fields. It includes a constructor to initialize these fields and a BMI method that calculates body mass index by dividing weight by the square of height and multiplying by 703. The main method creates a new Patient object, passing in values for name, height, and weight, and prints the result of calling BMI on that patient.
This code defines a Patient class with private name, height, and weight fields. It includes a constructor to initialize these fields and a BMI method that calculates body mass index by dividing weight by the square of height and multiplying by 703. The main method creates a new Patient object, passing in values for name, height, and weight, and prints the result of calling BMI on that patient.
This code defines a Patient class with private name, height, and weight fields. It includes a constructor to initialize these fields and a BMI method that calculates body mass index by dividing weight by the square of height and multiplying by 703. The main method creates a new Patient object, passing in values for name, height, and weight, and prints the result of calling BMI on that patient.