ch1sec2prob14.java
. Worth 10pts. Only output a single
true/false
value. Hint: Use the or operation (operator
'||
').
Input: | $ java ch1sec2prob14 10 5 |
Output: | true |
Input: | $ java ch1sec2prob14 3 9 |
Output: | true |
Input: | $ java ch1sec2prob14 42 5 |
Output: | false |
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()
.
Input: | $ java ch1sec2prob19 3 10 |
Output: | 6 |
Input: | $ java ch1sec2prob19 3 10 |
Output: | 8 |
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
.
Input: | $ java ch1sec2prob22 10 10 10 |
Output: | -379.01649999999995 |
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!
Input: | $ java ch1sec2prob29 9 1 2016 |
Output: | 4 |
Input: | $ java ch1sec2prob29 3 19 1991 |
Output: | 2 |
if-else
statements; instead use Math.min
and Math.max
to
assist your solution.
Input: | $ java ch1sec2prob34 5 4 3 |
Output: | 3 4 5 |
Input: | $ java ch1sec2prob34 5 5 5 |
Output: | 5 5 5 |
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.
Input: | $ java ch1sec2bonus | |||||||||||||||
Output: | ||||||||||||||||
|