Numbers and Math
Code
/// Name: Rachel Smith
/// Period: 5
/// Program Name: Numbers and Math
/// File Name: NumbersAndMath.java
/// Date Finished: 9/11/2015
public class NumbersAndMath {
public static void main( String[] args ) {
//This line will print a sentence
System.out.println( "I will now count my chickens:" );
//This line lists the number of Hens by adding 25 and 5
System.out.println( "Hens " + ( 25 + 30 / 6 ) );
//This line lists the number of Roosters by subtracting 3% of 100 from 100
System.out.println( "Roosters " + ( 100 - 25 * 3 % 4 ) );
//This line prints a sentence
System.out.println( "Now I will count the eggs:" );
//This line uses PEMDAS to find the number of eggs
System.out.println( 3 + 2 + 1 - 5 + 4 % 2 - 1.0 / 4.0 + 6 );
//This line prints a sentence
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//This line determines whether this inequality is true
System.out.println( 3 + 2 < 5 - 7 );
//This line prints a sentence and then adds 3 and 2
System.out.println( "What is 3 + 2? " + ( 3 + 2 ) );
//This line prints a sentence and then subracts 7 from 5
System.out.println( "What is 5 - 7? " + ( 5 - 7 ) );
//This line prints a sentence
System.out.println( "Oh, that's why it's false." );
//This line prints a sentence
System.out.println( "How about some more." );
//This line prints a sentence and then evaluates the verity of an inequality
System.out.println( "Is it greater? " + ( 5 > -2 ) );
//This line prints a sentence and then evaluates the verity of an inequality
System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
//This line prints a sentence and then evaluates the verity of an inequality
System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
}
}
Picture of the output