Assignment #11 Numbers and Math
Code
/// Name: John Huh
/// 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 )
{
// This gives the viewer of the what the person is going to do
System.out.println( "I will now count my chickens:" );
// This is their hens and chickens, with the numbers proceeding it that will display how many of each animal there is
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
// The numbers proceeding the counting eggs statement will determine how many eggs there are
System.out.println( "Now I will count my eggs:" );
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
// This is a question
System.out.println( "Is it true that 3.0 + 2.0 < 5.0 - 7.0?" );
// This provides the answer to the question
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
// The following statements are proceeded by numbers that will give a numerical answer
System.out.println( "What is 3.0 + 2.0? " + ( 3.0 + 2.0 ) );
System.out.println( "What is 5.0 - 7.0? " + ( 5.0 - 7.0 ) );
// This causes the text to be displayed
System.out.println( "Oh, that's why it's false." );
// This causes the text to be displayed
System.out.println( "How about some more." );
// The questions below have numbers at the end that will provide the answer to 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