Question: Please help me with my JAVA homework assignment. Use 2 files one for each class. Using VS code, create an Item class consisting of the

Please help me with my JAVA homework assignment.

Use 2 files one for each class.

Using VS code, create an Item class consisting of the following data about each item:

person name, age, height in inches, and weight in pounds.

Example of an item data:

name = Kathy

age: 20

height: 72

Weight: 188

The Person class also has two methods:

Method 1: a constructor of the item class to initialize the different variables.

Method2: calculate BMI

Given the weight and height of a person, the following console statement prints the BMI:

BMI-= (weight / Math.Pow(height, 2)) * 703);

Create a second class that has the main method and where you can create 3 different objects of the Person class.

SAMPLE CODE(JUST FOR REFERENCE):

import java.util.Scanner;

public class BMI1 {

// Use two separate class instead of the following

private static int calcBMI(int w, int h) {

int bml = (w * 703) / (h * h);

return bml;

}

public static void main(String[] args) {

String name;

int weight, height;

Scanner readIt = new Scanner(System.in);

System.out.println("Calcuate Body Mass Index(BMI)");

System.out.print("Enter name:");

name = readIt.nextLine();

System.out.print("Enter weight in pounds: ");

weight = readIt.nextInt();

System.out.print("Enter height in inches: ");

height = readIt.nextInt();

System.out.println("The BMI is: " + calcBMI(weight, height));

}

}

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!