Assignment #11 Numbers and Math
Code
///Name: Ian Grant
///Period:5
///Project Name: Numbers and Math
///File Name:NumbersAndMath.java
///10/5/15
public class NumbersAndMath
{
public static void main(String[] args)
{
//A floating numbers is a decimal
//Prints I will now count my chickens:
System.out.println("I will now count my chickens:");
//Prints Hen plus the result of 25+30/6
System.out.println("Hens "+(25.0+30.0/6.0));
//Prints Roosters plus the result of 100-25*3%4
System.out.println("Roosters"+(100.0-25.0*3.0%4.0));
//Prints Now I will count the eggs:
System.out.println("Now I will count the eggs:");
//Pirints the result of 3+2+1-5+4%2-1/4+6
System.out.println(3.0+2.0+1.0-5.0+4.0%2.0-1.0/4.0+6.0);
//Prints Is it true that 3 + 2 < 5 - 7?
System.out.println("Is it true that 3 + 2 < 5 - 7?");
//prints out a bool of false because 5 is not less than -2
System.out.println(3.0+2.0 < 5.0-7.0);
//Prints What is 3+2 plus the result of 3+2
System.out.println("What is 3 + 2? "+(3.0+2.0));
//Prints out What is 5-7 plus the result of 5-7
System.out.println("What is 5 - 7? "+(5.0-7.0));
//Prints Oh, that's why it's false.
System.out.println("Oh, that's why it's false.");
//Prints How about some more.
System.out.println("How about some more.");
//Prints Is it greater? plus the bool true because 5 is greater than -2
System.out.println("Is it greater? "+(5.0> -2.0));
//Prints Is it greater or equal? plus the bool true because 5 is greater than or equal to -2
System.out.println("Is it greater or equal? "+(5.0>= -2.0));
//Prints Is it less or equal? plus the bool false because 5 is not less than or equal to -2
System.out.println("Is it less or equal? "+(5.0<= -2.0));
}
}
Output