Assignemnt #11: Numbers and Math
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: NumbersAndMath
/// File Name: NumbersAndMath.java
/// Date Finished: 9/14/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
// this line adds 25 to 30/6 following Order of Ops
System.out.println( "Hens" + ( 25.0 + 30.0 /6.0 ) );
//this line is showing subtaction, multiplication along with the % which translats to 75 divided by 4, in which the remainder is 3 and 100-3=97.
System.out.println( "Roosters" + (100.0-25.0 * 3.0 % 4.0 ) );
System.out.println( "Now I will count the eggs:" );
//this line is adding and subtracting, with a remainder of 1, then divided by 10
System.out.println( 3 + 2 + 1 - 5 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//this statement is checking if 5 is less than 2
System.out.println( 3 + 2 < 5 - 7 );
//basic addition and subtraction on these two
System.out.println( "What is 3+2?" + ( 3 + 2 ) );
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." );
//these two are stating if 5 is greater than -2 or equal to
System.out.println( "Is it greater? " + ( 5 > -2 ) );
System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
//this last one says if 5 is greater than or equal to -2
System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
}
}
Picture of the output