Assignment #13 and Creating Variables
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Creating Variables
/// File Name: CreatingVariables.java
/// Date Finished: 9/14/2015
public class CreatingVariables
{
public static void main( String[] args )
{
int x, y, age;
double seconds, e, checking;
String firstName, last_name, title;
//Integer:
x = 10;
y = 400;
age = 39;
//Double:
seconds = 4.71;
e = 2.71828182845904523536;
checking = 1.89;
//String:
firstName = "Graham";
last_name = "Pollock";
title = "Mr.";
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 irrational number is Euler's constant: " + e );
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