Assignemnt #11 and Numbers and Math
Code
/// Name: Mark Katz
/// Period: 6
/// Program Name: Numbers and Math
/// File Name: NumbersAndMath.java
/// Date Finished: 9/10/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
//Counts and displays how many hens and roosters there are
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
//New title
System.out.println( "Now I will count the eggs:" );
//Shows the number 7
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
//Asks whether or not one value is less than the other
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//Answers the question above
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//Asks a math problem and solves it
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
//Says its false
System.out.println( "Oh, that's why it's false." );
//Asks about more equations
System.out.println( "How about some more." );
//Asks whether or not a number is greater or less then and answers the question
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output