Assignemnt #11: Numbers And Math

Code

    /// Name: Kelsey Lieberman
    /// Period 5
    /// Program Name: NumbersAndMath
    /// File Name: NumbersAndMath.java
    /// Date Finished: 9/14/2015
    
public class NumbersAndMath
{
    public static void main( String[] args)
    {
        // prints "I will now count my chickens:" on the screen
        System.out.println( "I will now count my chickens:" );
        // prints "Hens 30". adds 25 to (30/6), showing 30
		System.out.println( "Hens " + ( 25 + 30 / 6 ) );
        // prints "Roosters 97". multiplys 25 by 3 (=75) then takes the remainder of 75/4 (=3)and subtracts that from 100
		System.out.println( "Roosters " + ( 100 - 25 * 3 % 4 ) );
        // prints "Now I will count the eggs:"
		System.out.println( "Now I will count the eggs:" );
        // prints "6.75". takes remainder of 4/2 (=0) then divides 1.0 by 4.0 (=0.25). adds 3+2+1-5+0-0.25+6
		System.out.println( 3 + 2 + 1 - 5 + 4 % 2 - 1.0 / 4.0 + 6 );
        // prints "Is it true that 3 + 2 < 5 - 7?"
		System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
        // prints out "false" because the statement is false
		System.out.println( 3 + 2 < 5 - 7 );
        // prints "What is 3 + 2? 5"
		System.out.println( "What is 3 + 2? " + ( 3 + 2 ) );
        // prints "What is 5 - 7? " -2
		System.out.println( "What is 5 - 7? " + ( 5 - 7 ) );
        // prints "Oh, that's why it's false."
		System.out.println( "Oh, that's why it's false." );
        // prints "How about some more."
		System.out.println( "How about some more." );
        // prints "Is it greater? true" because 5 is grater than 2
		System.out.println( "Is it greater? " + ( 5 > -2 ) );
        // prints "Is it greater or equal? true" because 5 is greater than or equal to 2
		System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
        // prints "Is it less or equal? false" because 5 is not less than or equal to 2
		System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
	}
}


    

Picture of the output

Assignment 11