Assignemnt #9 and Printing Choices
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Numbers And Math
///File Name: NumbersAndMath.java
///Date Finished: 9/11/15
public class NumbersAndMath
{
public static void main( String[] args )
{
//prints a line
System.out.println( "I will now count my chickens:" );
//divides 30 by 6 and adds that to 25
System.out.println( "Hens " + ( 25.0+30.0/6.0 ) );
//times 25 by 3 then that subtracted from 100 then made a percent and times by 4
System.out.println( "Roosters " + ( 100.0 - 25.0 *3.0 % 4.0 ) );
//prints line
System.out.println( "Now I will count the eggs" );
//add numbers above divition and under divition sign then divided it
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 % 2.0 - 1.0 / 4.0 + 6.0 );
//prints line
System.out.println( "Is it true that 3.0 + 2.0 < 5.0 - 7.0" );
//tells whether the claim is true or false
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//prints line and adds numbers
System.out.println( "What is 3.0 + 2.0? " + ( 3.0 + 2.0 ) );
//prints line and subtracts numbers
System.out.println( "What is 5.0 - 7.0? " + ( 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 tests inequality
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//prints line and tests inequality
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//prints line and tests inequality
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output