Assignment #11 and Numbers And Math
Code
/// Name: Matthew Lorence
/// Period: 5
/// Program Name: Numbers And Math
/// File Name: NumbersAndMath.java
/// Date Finished:9/10/15
public class NumbersAndMath
{
public static void main( String[] args )
{
/// Prints out "I will now count my chickens"
System.out.println( "I will now count my chickens:" );
/// Prints out "Hens" and then prints out the answer to the equation in parentheses.
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
/// Prints out "Roosters" then prints out the answer to the equation in parentheses.
System.out.println( "Roosters " + ( 100 - 25 * 3.0 % 4.0 ) );
/// Prints out "Now I will count the eggs:"
System.out.println( "Now I will count the eggs:" );
/// Solves out the equation and gives the final answer.
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
/// Prints out "Is it true that 3 + 2 < 5 - 7>"
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
/// Answers the inequality with a true or false.
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
/// Prints out "What is 3 + 2?" then answers the equation in the second set of parentheses.
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
/// Prints out "What is 5 - 7?" and solves the equation.
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
///Prints out "Oh, that's why it's false."
System.out.println( "Oh, that's why it's false." );
///Prints out "How about some more."
System.out.println( "How about some more." );
/// Prints out "Is it greater?" then answers the inequality.
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
/// Prints out "Is it greater or equal?" then answers the inequality.
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
/// Prints out "Is it less or equal?" then answers the inequality.
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output