Lab #2

Solutions to the problems below are due by the end of lab time. If you have a printing account set up, then use a word processor to type your solutions and print them at the end of lab. Otherwise, I will also accept handwritten solutions.

Problems

  1. Write your first name using ASCII codes and then convert each of the ASCII codes into their binary representation. Be sure to start your name with a capital letter (e.g. upper-case letter). Below is an example, your answer should follow a similar format -- FYI, that's the name of one of my dogs.
    character ASCII code Binary Code
    T 8410 010101002
    i 10510 011010002
    m 10910 011011012
    b 9810 011000102
    e 10110 011001012
    r 11410 011100102
  2. The following sequence of binary digits represents a scrambled text message. To find out the message, first convert each byte into its ASCII code and then its corresponding ASCII character. Once you have all the ASCII characters, you need to combine them to form the message. Here is the sequence:
    011000110110111101100101001000010110000100100000010001110100001001101000
  3. According to the US Department of Health and Human Services' Centers for Disease Control:
    Body Mass Index (BMI) is a number calculated from a person’s weight and height. BMI is a reliable indicator of body fatness for people. BMI does not measure body fat directly, but research has shown that BMI correlates to direct measures of body fat
    This information (along with pictures below) come from the CDC's website on BMI. Use DrJava's Interaction Pane to use Java math expressions to determine your own BMI. Write down the calculations step-by-step and submit them as solutions. If you've programmed before, try using Java variables.

    The following figure gives the algorithm for calculating BMI. From CDC website. Algorithm for calculating BMI Categories of BMI

Programming Resources