Assignemnt #11 Numbers And Math
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Numbers and Numbers
///File Name: NumbresAndMath.java
///Date: 9/14/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
//displays "I will now count my chickens:" and goes to the next line.
System.out.println( "I will now count my chickens:" );
//displays "Hens" then calculates 25+30/6 and then displays the result afterwards.Then goes to the next line.
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//displays "Roosters" and calculates 100-25*3 and finds the ramainder of the result when divided by four. After that it displays the result after the word Roosters. Then it goes to the next line.
System.out.println( "Roosters " + ( 25.0 + 30.0 / 6.0 ) );
//displays the sentence "Now I will count the eggs:" and goes to the next line.
System.out.println( "Now I will count the eggs:" );
//calculates 3+2+1-5+4%2-1/4+6 and displays the result. Then it goes to the next line.
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
//displays "Is it true that 3 + 2 < 5 - 7?" without calculating the mathematical expression. Then it goes to the next line.
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//States wether the expression 3+2<5-7 is True or False. Then it goes to the next line.
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//displays "What is 3 + 2? " then calculates 3+2 and then displays the result.
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
//displays "What is 5 - 7? " then calculates 5+7 and displays the result. THen it goes to the next line.
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
//displays "Oh, that's why it's false." Then it goes to the next line.
System.out.println( "Oh, that's why it's false." );
//displays "How about some more." Then it goes to the next line.
System.out.println( "How about some more." );
//displays "Is it greater? " and then states whether 5> -2 is True or False. Then it goes to the next line.
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//displays "Is it greater or equal? " then states whether 5>= -2 is True or False. Then it goes to the next line.
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//displays "Is it less or equal? " then states whether 5<= -2 is True or False. Then it goes to the next line.
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output