Assignemnt #11: Numbers and Math
Code
/// Name: Cassie
/// Period: 6
/// Program Name: Numbers and Math
/// File Name: NumbersandMath.java
/// Date Finished: 9/11/2015
class NumbersandMath {
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
// output of Hen and value of Hens
System.out.println( "Hens " + (25 + 30 / 6 ) );
// output of Rooster and value of Roosters
System.out.println( "Roosters " + (100 - 25 * 3 % 4 ) );
System.out.println( "Now I will count the eggs:" );
// output of ( 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 )
System.out.println( 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 );
// output will say true if the statement is true
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
// output of the value of (3 + 2 < 5 - 7)
System.out.println(3 + 2 < 5 - 7 );
// The prints some text and then evaluates 3+2 and adds it to waht is printed
System.out.println( "What is 3 + 2? " + ( 3 + 2 ) );
// This does the same 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