Question: Create a class named Person in Java as follows: The class must have four instance variables: A string representing the name of the person A

Create a class named Person in Java as follows:

  1. The class must have four instance variables:
    • A string representing the name of the person
    • A floating-point number representing the weight of the person in kilograms
    • A floating-point number representing the height of the person in meters
    • A floating-point number representing the body temperature in Celsius
  2. The class must have two constructors:
    • A default constructor that initializes the instance variable string with default values
    • Another constructor that initializes the instance variable with specific values passed as parameters
  3. The class must have three methods:
    • computeBMI() that calculate and returns the Body Mass Index (BMI) of the person
    • celsiusToFahrenheit() that returns the temperature in Fahrenheit
    • celsiusToKelvin() that returns the temperature in Kelvin

Create another class Main that creates the objects of Person class and uses it:

  1. in the main method, create an object of Person class and call it p1:
    • Initialize the object p1: name = Joe Smith, weight = 85, height = 1.8 and temperature = 37 (Hint: use the appropriate constructor)
    • Call the method computeBMI using p1 and store the output in a variable bmi
    • Call the method celsiusToFahrenheit using p1 and store the output in a variable fahrenheit
    • Call the method celsiusToKelvin() using p1and store the output in a variable kelvin
    • Display the information stored in all the three variables with an appropriate message.
  1. A sample run of the program is provided in the screenshot below.

Show a screenshot of the output (if there is no screenshot of the output, the student shall get a zero mark for this question.

Use your name instead of Joe Smith).

**********************PLEASE I NEED MY NAME IN THE CODE (REEM ALANAZI)

*****************PLEASE DONT WRITE ANOTHER NAME

**********************IF YOU CAN MAKE ANOTHER SCREENSHOOT TO MY FRIEND HER NAME SHAHAD I WILL E HAPPY

****** TODAY THE LAST DAY OF HOMEWORK

****** PLEASE BE CARFUL I LOST TWO QUESTION BECAUSE THE NAME IS NOT CORRECT

Create a class named Person in Java as follows: The class must

- X G. C:\WINDOWS\system32\cmd.exe Initializing the application. Please wait... > Hello Mr. Joe Smith. Please note that: 1. Your weight is 55.0 kg 2. Your height is 1.5 meters 3. Your temperature measured in Celsius is 36.0 Your BMI and temperature information is as shown below: You BMI is: 24.444444444444443 You temperature in Fahrenheit is: 96.8 You temperature in Kelvin is: 309.0 Press any key to continue

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!