Lab 3: generating the bmi table

Lab 3: Generating the BMI Table

The goal of this lab is to write a code BMITable.java that produces a table of BMI (the Body-Mass Index). The body-mass index of a person is determined by the height and weight of the person, given by the formula:

703.0 * (the height in inches) / (the weigh in pounds)-squared.

Our goal is to write a code that produces a table that shows the BMI value for a range of height and a range of weight.

The lab task consists of two parts. Part 1 is worth ten points and part 2 is worth two extra points. In Part 1, the size parameters for the table will be fixed while in Part 2, the size parameters will be entered by the user.

Part 1: Fixed-size BMI Table

We will use a double loop for the table generation. The rows of the table are the weight, which ranges from 260 pounds down to 80 pounds with the step-width of 5 (that is, the values are 260, 255, 250, …). The columns of the table are the height, which ranges from 56 inches to 76 inches with the step-width of 2 (that is, the values are 56, 58, 60, …). We use the formula 703.0 * weight / (height * height) for calculating the value. We will print each BMI value using System.out.printf(“%5.1f”, xxx) to print xxx in five chater spaces with one digit below the decimal point.

 

 

 

template

 

// compute and pring a BMi Table
public class BMITable {
  //----------------------------------------
  // printout the separator
  //----------------------------------------
  public static void theSeparator() {
    System.out.print("-------+");
    for (int position = 1; position <= 55; position ++) {
      System.out.print("-");
    }
    System.out.println();
  }
  //----------------------------------------
  // printout the header
  //----------------------------------------
  public static void theHeader() {
    //----------------------------------------
    // ******** NEED CODE HERE FOR THE FIRST LINE OF HEADER
    //----------------------------------------
    System.out.print("(lbs.) |");
    //----------------------------------------
    // ******** NEED CODE HERE FOR THE REST ***********
    //----------------------------------------
  }
  //----------------------------------------
  // compute and print out the table
  //----------------------------------------
  public static void theTable() {
    //----------------------------------------
    // ******** NEED CODE HERE ***********
    //----------------------------------------
  }
  //----------------------------------------
  // main
  //----------------------------------------
  public static void main(String[] args) {
    theSeparator();
    theHeader();
    theSeparator();
    theTable();
    theSeparator();
  }
}

 







Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Get 15% OFF on your FIRST order. Use the coupon code: new15