ExpressionsThing.java
1    /* This program is used to solve simple 
2     * arithmetic expressions within the context 
3     * of problem-solving. 
4     */
5    package expressions;
6    
7    import javax.swing.*;
8    
9    public class ExpressionsThing {
10       public static void main(String[]args) {
11           // Task 3
12           double one = 3.14*5+5; //doesn't produce expected result
13           System.out.println("one=" + one);
14           double two = 3.14*(5+5);
15           System.out.println("two=" + two);
16           double three = (3.14*(5+5)); //Fully parenthesized
17           System.out.println("three=" + three);
18   
19           // Task 4
20           int four = (5*6);
21           System.out.println("four=" + four);
22           double five = (1.0/2*55); //one-half of fifty-five
23           System.out.println("five=" + five);
24           double six = (1.0/3*65); //one-third of sixty-five
25           System.out.println("six=" + six);
26           double seven = ((1.0/2*55)+(1.0/3*65));
27           System.out.println("seven=" + seven);
28   
29           // Task 5
30           double eight = (3.14*(11.3*11.3));
31           System.out.println("eight=" + eight);
32           double nine = (27.7*27.7);
33           System.out.println("nine=" + nine);
34           double ten = ((11.3*11.3)+(27.7*27.7));
35           System.out.println("ten =" + ten);
36           double eleven = ((1.0*.17)*243.5);
37           System.out.println("eleven=" + eleven);
38   
39           // Task 6
40           int twelve = (3/3);
41           System.out.println("twelve=" + twelve);
42           int thirteen = ((7-2)-4);
43           System.out.println("thirteen=" + thirteen);
44           int fourteen = ((9-7)+(3-1));
45           System.out.println("fourteen=" + fourteen);
46           int fifteen = ((8-6)+4-(2/2));
47           System.out.println("fifteen=" + fifteen);
48   
49           SwingUtilities.invokeLater(new Runnable() {
50               public void run(){
51                   new ExpressionsThing();
52               }
53           });
54       }
55   }
56