Utility Classes
E = mc
^{2}
where m
is mass (in kilograms), c
is the speed of light
(in metres per second), and E
is energy (in joules).
Use your utility class to compute the amount of energy equivalent
to one gram of matter (this is approximately equal to the energy
released by the first atomic bomb detonated during the Trinity test).
java.lang.Math
is very useful,
but its methods assume that you want to work with just one value
at a time. Create a utility class called ArrayMath
that has methods that operate on arrays of numbers. Your utility
class should provide the following methods:static double[] cos(double[] a)
static double[] sin(double[] a)
static double[] tan(double[] a)
a
is not empty. Also, your method must not modify the
elements in a.
ArrayMath
the following
methods:static double max(double[] a)
static double min(double[] a)
static double mean(double[] a)
a
is not empty. Also, your method must not modify the
elements in a.
StringUtils
that provides methods
that operate on strings. Implement the following methods:static String reverse(String s)
static boolean isPalindrome(String s)
true
if s.equals(StringUtils.reverse(s)) == true
and false
otherwise.ArrayMath
the following
methods:static int[] mode(int[] a)
a
is not empty. Also, your method must not modify the
elements in a.
Yahtzee
utility from the labs. To implement
the game of Yahtzee as a computer program you need to determine the
score associated with a roll of the dice. Look up the rules for
Yahtzee and add a method or methods to the Yahtzee
utility
that compute the score of a roll.