Assignment #11, Numbers and Math
Code
///Name: Stella Koliavas
///P: 5
///Program Name: NumbersAndMath
///File Name: NumebersAndMath.java
///Date Finished: 9/14/15
public class NumbersAndMath
{
public static void main( String[] args )
{
//This just prints the line regularly
System.out.println( "I will now count my chickens:" );
//This prints the line and divides the number 30 by 6 then adds 25
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//Prints the line and then multiplies 25 by 3, divides that number by 4 and then subracts the remainder from 100
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
//Prints line
System.out.println( "Now I will count the eggs:" );
//Calculates
System.out.println( 3.0 + 2.0 + 1.0 - 5.0+4.0%2.0-(1.0/4.0) + 6.0 );
//Prints Line
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//Calculates whether true or false
System.out.println( 3.0+2.0< 5.0-7.0);
//Prints line and then calculates whether true or false
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
//Prints line and then calculates whether true or false
System.out.println( "What is 5 - 7?" + ( 5.0 - 7.0 ) );
//Prints line
System.out.println( "Oh, that's why it's false." );
//Prints line
System.out.println( "How about some more." );
//Prints line and then calculates
System.out.println( "Is it greater? " + ( 5.0>-2.0 ));
//Prints line and then calculates
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ));
//Prints line and then calculates
System.out.println( "Is it less or equal? " + ( 5.0<= -2.0 ));
}
}
Picture of the output