Assignemnt #11 Numbers and Math
Code
Name: Iaroslav Titov
Period: 7
Project Name: NumbersAndMath
File Name: NumbersAndMath.java
Date: 9/11/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
// informs user what we will do
System.out.println( "I will now count my chickens:" );
// counts female chicken
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
// counts male chicken
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
// informs user that we will count unborn chicken
System.out.println( "Now I will count the eggs:" );
// counts unborn chicken
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
// asks user rheutoric question
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
// answers it self by letting computer do the computations
System.out.println( 3.0 + 2 < 5.0 - 7 );
// asks math problems and makes computer answer
System.out.println( "What is 3 + 2? " + ( 3.0 + 2 ) );
// asks math problems and makes computer answer
System.out.println( "What is 5 - 7? " + ( 5.0 - 7 ) );
// explanation
System.out.println( "Oh, that's why it's false." );
// informs user that more is coming
System.out.println( "How about some more." );
// asks math problems and makes computer answer
System.out.println( "Is it greater? " + ( 5 > -2 ) );
System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
}
}
Picture of the output