Assignment #13

Code

    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: CreatingVariables
    ///File Name: CreatingVariables.java
    ///Date: 9/15/15
    
    public class CreatingVariables
    {
        public static void main( String[] args )
        {
        
        //Defining different variable types
        int x, y, age;
        double seconds, pi, checking;
        String firstName, last_name, title;
        
        //Assigns values to different integer variables
        x = 10;
        y = 400;
        age = 39;
        
        //Assigns values to different double variables
        seconds = 4.71;
        pi = 3.14159265359;
        checking = 1.89;
        
        //Assigns different values to different Strings
        firstName = "Cody";
        last_name = "Swain";
        title = "Mr.";
        
        //Now prints a bunch of information to the Output
        System.out.println( "The variable x contains " + x );
        System.out.println( "The value " + y + " is stored in the variable y." );
        System.out.println( "The experiment completed in " + seconds + " seconds." );
        System.out.println( "My favorite number is pi: " + pi );         
        System.out.println( "Hopefully your balance is more than $" + checking + "!" );
        System.out.println( "My full name is " + title + " " + firstName + last_name );
        }
    }
    
    

Picture of the output

Assignment 13