Programming Assignment 02


Due: Week of Sep. 5 in lab


  1. Problem 1.2.14 on page 41 of your book. Name the file and program ch1sec2prob14.java. Worth 10pts. Only output a single true/false value. Hint: Use the or operation (operator '||').
    Examples:
  2. Problem 1.2.19 on page 41 of your book. Name the file and program ch1sec2prob19.java. Worth 10pts. Only output a single value. You should assume that a is less than b. You cannot use the Java class/utility Random; you must use Math.random().
    Examples:
  3. Problem 1.2.22 on page 41 of your book. Name the file and program ch1sec2prob22.java. Worth 10pts. Only output a single value. Note the equation in the book has a slight issue, either change g to be negative or change the equation to subtract g*t^2/2. The final equation would be x_0 + v_0*t - g*t^2/2.
    Examples:
  4. Problem 1.2.29 on page 42 of your book. Name the file and program ch1sec2prob29.java. Worth 35pts. Only output a single value, do not output the day as a String. The input will be in m d y ordering!
    Examples:
  5. Problem 1.2.34 on page 44 of your book. Name the file and program ch1sec2prob34.java. Worth 35pts. Print three values separated by spaces. Do not assume that the values are unique! Do not use if-else statements; instead use Math.min and Math.max to assist your solution.
    Examples:
  6. Bonus. Write a program to output the truth table values for XOR or exclusive or. Please neatly format the output to show the values of a, b, and a^b where a^b is the exclusive or operation. Name the file and program ch1sec2bonus.java. Worth 10pts. Do not hardcode the answer to each a^b. Rather compute it with a boolean expression.
    Example: