Printing #11 (I stopped counting...)

Code

   /// Name: Amir Salehi
    /// Period: 7
    /// Program name:NumbersAndMath
    /// File name: NumbersAndMath.java
    /// Date: Finished 9/172015
public class NumbersAndMath
{
	public static void main( String[] args )
	{
		System.out.println( "I will now count my chickens:" );

		System.out.println( "Hens " + ( 25.35 + 30.87 / 6 ) );
		System.out.println( "Roosters " + ( 100.56 - 25.32 * 3.87 % 4 ) );
                            //The Java program uses PEMDAS to solve the equation.
		System.out.println( "Now I will count the eggs:" );

		System.out.println( 3.43 + 2.436 + 1.534 - 5.4321 + 4.1432 % 2 - 1.123 / 4 + 6.231 );
    //As same at here, first the java program checks if there's any numbers that it can divide or multiply then it moves on to addition and subtraction.
		System.out.println( "Is it true that 3.6434 + 2.531 < 5.656 - 7.543?" );

		System.out.println( 3.5484 + 2.5747 < 5.2949 - 7.6737 );
        //Also Notice how I put decimals in numbers and not fractions, because the java program can only do "Floating Point" AKA decimals.
		System.out.println( "What is 3.4756 + 2.5873? " + ( 3.4756 + 2.5873 ) );
		System.out.println( "What is 5.98 - 7.45? " + ( 5.98 - 7.45 ) );

		System.out.println( "Oh, that's why it's false." );

		System.out.println( "How about some more." );

		System.out.println( "Is it greater? " + ( 5.98 > -2.45 ) );
		System.out.println( "Is it greater or equal? " + ( 5.324 >= -2.3254 ) );
		System.out.println( "Is it less or equal? " + ( 5.432656 <= -2.999999 ) );
	}
}
    

Picture of the output

Assignment 7

Back to Homepage