Assignemnt #11 and Numbers and math
Code
///Name: Ben Borglin
///Period: 6
///Program Name: Numbers and Math
///File Name: NumbersAndMath.java
///Date Finished:
public class NumbersAndMath
{
public static void main( String[] args )
{
//Says I will now count my chickens
System.out.println( "I will now count my chickens:" );
//adds up the amount of 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 ) );
//displays 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 );
//displays Is it true that 3=2 < 5-7?
System.out.println( "Is it true that 3.0 + 2.0 < 5.0 - 7.0?" );
//Solves and displays false
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//displays what is written and displays the answer
System.out.println( "What is 3.0 + 2.0? " + ( 3.0 + 2.0 ) );
//displays what is 5-7 and displays -2
System.out.println( "What is 5.0 - 7.0? " + ( 5.0 - 7.0 ) );
//displays new title
System.out.println( "Oh, that's why it's false." );
//displays another title
System.out.println( "How about some more." );
//displays is it greater? and says true
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//displays is it greater or equal? and says ture
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//displays is it greater or equal? and displays false
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output