Assignemnt #11 and Eighth Program
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Math
/// File Name: Math.java
/// Date Finished: 9/11/2015
class Math {
public static void main(String[] args) {
System.out.println( "I will now count my chickens:" );
//Line adds 25 and 30 and divides 6
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//subtracts multiplies and takes the percent
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
System.out.println( "Now I will count my eggs:" );
//add add subtract add percent subtract divide add
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 is true that 3 + 2 < 5 - 7?" );
//finds if it is greater than or less than
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
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.");
//true or false
System.out.println( " Is it greater? " + ( 5.0 > -2.0) );
//true or false
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//true or false
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output