Assignment #11 and Numbers and Math
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: Numbers and Math
/// File Name: NumberAndMath.java
/// Date Finished: 9/14/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
//prints Hens and a number
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//prints Roosters and a number
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
System.out.println( "Now I will count the eggs:" );
//prints the answer of this math equation
System.out.println( 3 + 2 + 1 - 5 + 4.0 % 2.0 - 1.0 / 4.0 + 6 );
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//prints false because 5 isn't less than -2
System.out.println( 3 + 2 < 5 - 7 );
//prints question and answer
System.out.println( "What is 3 + 2? " + ( 3 + 2 ) );
//prints question and answer
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." );
//prints true or false based on correct/incorrect math statements
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