Assignment 11: Numbers and Math
Code
/// Name: Ryan McAteer
/// Period: 5
/// Program Name: Numbers and Math
/// File Name: Assignment11.java
/// Date Finished: 9/10/15
class Assignment11
{
public static void main(String[] args)
{
//Print Statement//
System.out.println( "I will now count my chickens:" );
//Divides 30 by 6 then adds 25//
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//Multiplies 25 by three with four remaining//
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
System.out.println( "Now I will count the eggs:" );
//Adds 3, 2, and 1, subtracts 5 than divides 4 by 2 and subtracts 1 divides by four, and adds 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?" );
//Is 3 plus 2 less than 5 minus 7//
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//Adds three and two//
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
//Subtracts seven from five//
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
System.out.println( "Oh, that's why it's false." );
System.out.println( "How about some more." );
//Is five greater than negative two?//
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//Is five greater than or equal to negative two?//
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//Is five less than or equal to negative two?//
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output