Programming Assignment #14

Code

/// Name: Dylan Sleeper
/// Period: 6
/// Program Name: MoreVariables
/// File Name: MoreVariables.java
/// Date Finished: 9/22/2015

public class MoreVariablesAndPrinting
{
    public static void main( String[] args )
    {
        String Name, Eyes, Teeth, Hair;
        double Age, Height, Weight, cmHeight, kgWeight;
        
        Name = "Dylan Sleeper";
        Age = 36;     // not a lie
        Height = 68;  // inches
        cmHeight = Height * 2.54;
        Weight = 120; // lbs
        kgWeight = Weight * 0.453592;
        Eyes = "Hazel";
        Teeth = "White";
        Hair = "Brown";

        System.out.println( "Let's talk about " + Name + "." );
        System.out.println( "He's " + Height + " inches tall and is " + cmHeight + " centimeters tall.");
        System.out.println( "He's " + Weight + " pounds and is " + kgWeight + " kilograms." );
        System.out.println( "Actually, that's not too heavy." );
        System.out.println( "He's got " + Eyes + " eyes and " + Hair + " hair." );
        System.out.println( "His teeth are usually " + Teeth + " depending on the coffee." );

        // This line is tricky; try to get it exactly right.
        System.out.println( "If I add " + Age + ", " + Height + ", and " + Weight
            + " I get " + (Age + Height + Weight) + "." );
    }
}

  
  

Outputs

Assignment 14