Java Assignment: Creating a Person Class with Body Mass Index Calculation, Assignments of Computer Science

Instructions for an assignment in computer science 121 where students are required to create a java application with two classes. The main class initializes a person object and calls a method to calculate and display the person's body mass index. The person class contains data for name, weight in pounds, and height in feet and inches.

Typology: Assignments

Pre 2010

Uploaded on 08/09/2009

koofers-user-bpu-2
koofers-user-bpu-2 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer Science 121
Assignment 2
Due: October 4, 1999
Create a Java application that has two classes, one containing the main method that starts the
action and the other that describes a person. The data for this class should be a person's name,
weight in pounds and height in feet and inches. Assign reasonable values for these in the
constructor for the class.
A second method should calculate and display the person's body mass index. To compute this,
multiply the person's weight in pounds by 705. Then divide this result by the person's height in
inches squared. For example, if the person weighs 120 pounds and is 5 feet 2 inches tall (62
inches), his or her body mass index is (120 * 705) / (62 * 62) or 22.
The main method should declare a person and then call the appropriate method to display the
person's body mass index.

Partial preview of the text

Download Java Assignment: Creating a Person Class with Body Mass Index Calculation and more Assignments Computer Science in PDF only on Docsity!

Computer Science 121 Assignment 2 Due: October 4, 1999 Create a Java application that has two classes, one containing the main method that starts the action and the other that describes a person. The data for this class should be a person's name, weight in pounds and height in feet and inches. Assign reasonable values for these in the constructor for the class. A second method should calculate and display the person's body mass index. To compute this, multiply the person's weight in pounds by 705. Then divide this result by the person's height in inches squared. For example, if the person weighs 120 pounds and is 5 feet 2 inches tall ( inches), his or her body mass index is (120 * 705) / (62 * 62) or 22. The main method should declare a person and then call the appropriate method to display the person's body mass index.