Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions