Assignment #11 and Numbers And Math
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Numbers And Math
/// File Name: NumbersAndMath.java
/// Date Finished: 9/10/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
//Prints Text
System.out.println( "I will now count my chickens:" );
//adds 30/6 to 25
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//prints the product of 100-25 times 3 with remainder 4
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3 % 4 ) );
//prints text on a new line
System.out.println( "Now I will count the eggs:" );
//prints the anser to the equation
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4 % 2 - 1.0 / 4.0 + 6.0 );
//prints text
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//determines whether the equation is true or false
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//prints text and add an equation to the print line
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
//prints text and add an equation to the print line
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
//Prints Text
System.out.println( "Oh, that's why it's false." );
//prints text
System.out.println( "How about some more." );
//prints text and determines wether the equation is true or false
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//prints text and determines wether the equation is true or false
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//prints text and determines wether the equation is true or false
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output