Program #14

Code

   
    /// Name: Afaf Nabeeha
    /// Period: 7
    /// Program Name: More Variables and Printing
    /// File Name: MoreVariables.java
    /// Date Finished: 9/22/2015 public class MoreVariables
          
          
        public class MoreVariables
        {
            public static void main( String[] args )
            {
                String myName, myEyes, myTeeth, myHair;
                int myAge, myHeight, myWeight;
                double kilogram, weightInKilograms, cm, heightInCentimeters;
        
                myName = "Afaf Nabeeha";
                myAge = 15;     // not a lie
                myHeight = 64;  // inches
                myWeight = 108; // lbs
                kilogram = .454; // kg
                weightInKilograms = kilogram*myWeight;
                cm = 2.54; //cm
                heightInCentimeters = cm*myHeight;
                myEyes = "Brown";
                myTeeth = "White";
                myHair = "Black";
        
                System.out.println( "Let's talk about " + myName + "." );
                System.out.println( "She's " + myHeight + " inches tall." );
                System.out.println( "That's " + heightInCentimeters + " in centimeters." );
                System.out.println( "She's " + myWeight + " pounds." );
                System.out.println( "That's " + weightInKilograms + " kilograms." );
                System.out.println( "Actually, that's not too heavy." );
                System.out.println( "She's got " + myEyes + " eyes and " + myHair + " hair." );
                System.out.println( "Her teeth are usually " + myTeeth + " depending on the coffee." );
        
                // This line is tricky; try to get it exactly right.
                System.out.println( "If I add " + myAge + ", " + myHeight + ", and " + myWeight
                    + " I get " + (myAge + myHeight + myWeight) + "." );
            }
        }
    

Picture of the output

Assignment 14