/* * this program affords opportunities to explore the construction of arithmetic expressions * in the context of some very simple problem solving * such as how to use parentheses properly. */ package expressions; import static java.lang.Math.sqrt; public class ExpressonsThing { public static void main(String[] arg) { double one = 3.14 * 5 + 5; System.out.println("One = " + one); double two = 3.14 * (5 + 5); System.out.println("Two = " + two); double three = ((3.14) * (5 + 5)); System.out.println("three = " + three); /* The first statement of each pair is supposed to introduce a variable and bind it to a value expressed * as a straightforward translation of an English phrase representing a numeric computation. *The second statement of the pair is merely supposed to display the value of the expression, reasonably labelled. */ int four = (2 * 3); //* The 1st statement of the pair System.out.println("four = " + four); //* The 2nd statement of the pair double five = (55.0 / 2.0); System.out.println("five = " + five); double six = (65.0 / 3.0); System.out.println("Six = " + six); double seven = ((55.0 / 2.0) + (65.0 / 3.0)); System.out.println("Seven = " + seven); double eight = (3.14 * (11.3 * 11.3)); System.out.println("eight = " + eight); double nine = (27.7 * 27.7); System.out.println("nine = " + nine); double ten = ((eight + nine) / 2.0); System.out.println("ten = " + ten); double eleven = (0.17 * 243.5); System.out.println("eleven = " + eleven); /* ?: How do I use the direct command line to figure out the percentage of double eleven? */ /*The first statemnet of each pair is supposed to introduce a variable and bind it to a solution to a Crypto problem. * The second statement is merely supposed to display the value of the expression, resonably labelled. */ //* Crypto #1: use the numbers 3 as the sources to evaluate to the number 1 as goal. int twelve = (3/3); System.out.println("twelve = " + twelve); //*use the numbers 4, 7, 2 as the sources to evaluate to the number 1 as goal. int thirteen = (7-(4+2)); System.out.println("thirteen = " + thirteen); //*use the numbers 1, 3 ,7, 9 as sources to evaluate to the number 4 as goal. int fourteen = ((9-1)-(7-3)); System.out.println("fourteen = " +fourteen); //*Use 2, 2, 4, 6, 8 as the sources to evaluate to the number 5 as goal. int fifteen = (int) (sqrt((8+2)*(6+4))/2); System.out.println("fifteen = " + fifteen); } }