#### ASSIGNMENT 2

The goal of this assignment is to work with data types and expressions. You will also practice printing output so that it is formatted correctly,
Be sure you pay attention to your header comment, other comments and variable names.

**Part 1: **__ Distance Between Two Points__

The straight line distance between two points (*x*1, y1) and (x2, y2) on a Cartesian coordinate plane is given by the equation:

Your program will take in the values of the x1, y1 and x2, y2 points as integers from the command line. It must then calculate the distance between the two points. For example, if the input was 0 0 3 4, your program would calculate and output the distance between (0, 0) and (3, 4) which is 5. Of course, the answer should be something else if the arguments on the command line are different.

In Java, to take the square root of a number, say x, use the static helper method:

Math.sqrt(x)

To raise a number x to a power, say 2, you can use:

Math.pow(x, 2)

The output from your program should be formatted exactly as below, with the command line input shown between parentheses and the result of your equation at the end:
The distance between (0, 0) and (3, 4) is 5.0

Name your program Distance.java.

**Part 2: ****Birthday Wizard**

Given a person's year of birth and an age, both from the command line, calculate what year they will be (or were) that age. Your output should look like:

You will (or did) turn 21 in the year 2020.

Name this program Birthday.java.

**Part 3: ****Boolean Logic**

In the command line arguments you should enter boolean values for the variables `" wet"`, `"cold"`, `"poor"`, and `"hungry"`. If a person is (wet and cold) or (poor and hungry), then that person is miserable. Using boolean operators in a boolean expression, calculate whether a person is miserable and print out the result as follows:

You're miserable: true

Of course, if it works out that the person is not miserable, you're program should print out `false` rather than `true`. To enter boolean values in the command line for arguments, simply type `true` or `false`. Remember, you should have four arguments, one for each of the variables.

Name this program Logic.java.

**Grading** Each of the three programs is worth 10 points each, for a total of 30 points. For each program, you will be graded according to the following criteria:

Grade Item | Distance | Birthday | Logic | Points Earned |

Program Compiles | 2 | 2 | 2 | |

Program Runs | 2 | 2 | 2 | |

Header Comment |
2 | 2 | 2 | |

Program Runs Correctly (including correctly formatted output) | 4 | 4 | 4 | |

**Submission.**
Submit all three programs `Distance.java`, `Birthday.java`, and `Logic.java` via Moodle.
Be sure each submitted source file has the required header with your name, and a description of the program.
Also be sure to submit the .java source files and not the .class files!

Page last updated: August 15, 2018