Assignemnt #4 First Program
Code
/// Name: DeeJay Cerezo
/// Period: 7
/// Program Name: Escape Sequences
/// File Name: EscapeSequences.java
/// Date Finished: 9/11/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
// This line prints out what is in the quotes.
System.out.println( "I will now count my chickens:" );
// This line solves the equation outside of the quotes.
System.out.println( "Hens " + ( 25 + 30 / 6 ) );
// = is addition, - subtraction, * multiplication, % percentage, / division
System.out.println( "Roosters " + ( 100 - 25 * 3 % 4 ) );
//It solves the equation
System.out.println( "Now I will count the eggs:" );
//It just solves the equation again
System.out.println( 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 );
//It prints what is in the quotes
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//TThe computer says its is false because 5 < 7
System.out.println( 3 + 2 < 5 - 7 );
//the equation gets solved
System.out.println( "What is 3 + 2? " + ( 3 + 2 ) );
//same
System.out.println( "What is 5 - 7? " + ( 5 - 7 ) );
System.out.println( "Oh, that's why it's false." );
System.out.println( "How about some more." );
//the computer says whether the equation is true or false
System.out.println( "Is it greater? " + ( 5 > -2 ) );
System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
}
}
Picture of the output