Assignment #11 and Numbers And Math
Code
///Name:Tim Gibson
///Period: 6
///Project Name: Numbers and Math
///File Name: NumbersAndMath.java
///Date Finished: 9/11/15
public class NumbersAndMath
{
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
//divides 30 by 6 to get 5, then adds it to 25
System.out.println( "Hens " + (25.0 + 30.0 / 6.0) );
// multiplies 25 by 3, then divides by 4, takes the remainder, and subtracts it from 100
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
System.out.println( "Now I will count the eggs:" );
//adds up all the numbers, and 0 cuz 4/2 has remainder 0 and adds one fourth for 1/4, rounds up to 7
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
System.out.println( "Is it True that 3 + 2 < 5 - 7?" );
//computer evaluates the inequality
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//adds 3 to 2
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
//subtracts 7 from 5
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
System.out.println( "Oh, that's why it's false." );
System.out.println( "How about some more." );
//evaluates inequality
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//evaluates inequality
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//evaluates inequality
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output