Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the 2 photos are one Question ,please answer it by computer not by handwriting. thank you II Create a class named Person in Java as

image text in transcribed

image text in transcribed

the 2 photos are one Question ,please answer it by computer not by handwriting.

thank you

II Create a class named Person in Java as follows: 1. The class must have four instance variables: O A string representing the name of the person O A floating-point number representing the weight of the person in kilograms O A floating-point number representing the height of the person in meters O A floating-point number representing the body temperature in Celsius 2. The class must have two constructors: O A default constructor that initializes the instance variable string with default values 0 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 IcelsiusToFahrenheit) that returns the temperature in Fahrenheit I celsiusToKelvin) that returns the temperature in Kelvin Create another class Main that creates the objects of Person class and uses it: 4. 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) i Call the method compute BMI using pi and store the output in a variable bmi II Call the method celsius ToFahrenheit 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. 5. 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"). 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+1 What would you do if you were the IHR manager?

Answered: 1 week ago