Assignment 11; NumbersAndMath
Code
//Name: Donovan Rich
//Period: 6
//Program name: Numbers and Math
//File Name: NumbersAndMath
//Date Completed: 9/11/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
//This prints "Hens" followed by the value of the mathematical problem of 25 plus the quotient of 30 divided by 6.
System.out.println( "Hens " + ( 25 + 30 / 6 ) );
//This prints "Roosters" followed by the value of "100 subtracted by the remainder of '25 times 3' divided by 4".
System.out.println( "Roosters " + ( 100 - 25 * 3 % 4 ) );
System.out.println( "Now I will count the eggs:" );
//This prints the value of "3 + 2 + 1 - 5 + plus the remainder of 4/2 - the quotient of 1/4 + 6.
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//If the mathetmatical statement is true, this prints "true". Otherwise, it prints "false".
System.out.println( 3 + 2 < 5 - 7 );
//This prints some text and then evaluates "3+2" and adds it to what is printed.
System.out.println( "What is 3 + 2? " + ( 3 + 2 ) );
//This does the same thing as above but with "5-7).
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." );
//If the mathematical statement between () is true, it prints "true". Otherwise, it prints "false".
System.out.println( "Is it greater? " + ( 5 > -2 ) );
//Same as above.
System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
//Same as above.
System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
}
}
Picture of the output