Assignemnt #11 and Numbers and Math
Code
/// Name: Tristan Chung
/// Period: 5
/// Program Name: NumbersAndMath
/// File Name: NumbersAndMath.java
/// Date Finished: 9/11/2015
public class NumbersAndMath
{
public static void main( String[] args )
{
System.out.println( "I will now count my chickens:" );
// This line sets a operand that adds 25 to (30/6) after the division.
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
// This line sets a operand that subtracts (25 times 3 modules by 4) from 100.
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
System.out.println( "Now I will count the eggs:" );
// This line sets a operand that adds 3+2+1-5 to 4 modules by 2 and then subtractracted by .25 and add 6.
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?" );
// This line asks if 3+2 is less than 5-7 and the computer answers false.
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
// Asks what is 3+2 and then gives operand for computer to solve.
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
// Gives operand for computer to solve what is 5-7.
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." );
// Gives operand for computer to solve true or false, whether 5 is greater than -2.
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
// Gives operand for computer to solve true or false, whether 5 is greater than or equal to -2.
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
// Gives operand for computer to solve true or false, whether 5 is less than or equal to -2.
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output