Assignment #11 and Numbers and Math
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Numbers and Math
/// File Name: NumbersAndMath.java
/// Date Finished: 9/10/2015
//A floating-point number is a number that has a decimal point with any number of digits before or after.
public class NumbersAndMath
{
public static void main( String[] args )
{
//prints the words in quotes within the parentheses
System.out.println( "I will now count my chickens:" );
// prints the word "Hens" and performs (and displays the result of) the operation 25+ 30/6
System.out.println( "Hens " + ( 25.0 + 30.0 / 6.0 ) );
//prints the word "Rooster" and performs the operation 100- 25 * 3 % 4
System.out.println( "Roosters " + ( 100.0 - 25.0 * 3.0 % 4.0 ) );
//prints the words in quotes within the parentheses
System.out.println( "Now I will count the eggs:" );
//performs the operation in parentheses
System.out.println( 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0 );
//prints the words in quotes
System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
//performs the operation in the parentheses and displays whether or not the equation is true
System.out.println( 3.0 + 2.0 < 5.0 - 7.0 );
//prints the words in quotes, performs the operation outside of the quotes in parentheses, and displays the results
System.out.println( "What is 3 + 2? " + ( 3.0 + 2.0 ) );
//prints the words in quotes and performs the operation outside of quotes in parentheses, and displays the results
System.out.println( "What is 5 - 7? " + ( 5.0 - 7.0 ) );
//prints the words in quotes
System.out.println( "Oh, that's why it's false." );
//prints the words in quotes
System.out.println( "How about some more." );
//prints the words in quotes and displays whether or not the equation in parentheses is true
System.out.println( "Is it greater? " + ( 5.0 > -2.0 ) );
//prints the words in quotes and displays whether or not the equation in parentheses is true
System.out.println( "Is it greater or equal? " + ( 5.0 >= -2.0 ) );
//prints the words in quotes and displays whether or not the equation in parentheses is true
System.out.println( "Is it less or equal? " + ( 5.0 <= -2.0 ) );
}
}
Picture of the output