The exercises here are taken from my forthcoming book
The Java Developer's Resource.
What happens if you try to take the square root of a negative number?
What happens if you use java.lang.Math.pow to raise zero to the zeroth power?
What, if anything, can come before a package statement in a Java source code file?
What, if anything, can come before an import statement in a Java source code file?
Can one source code file import from more than one package?
Although mathematicians prefer to work in radians, most scientists and engineers find it easier to think in degrees. Write sine, cosine and tangent methods that accept their arguments in degrees.
Write the corresponding set of inverse trigonometric methods that return their values in degrees instead of radians.
The math library is missing secant, cosecant and cotangent methods. Write them.
The math library lacks a log10 method for taking the common logarithm. Write one.
Computer scientists often use a log2 (log base 2). java.lang.Math doesn't have one of those either. Write it.
A simple model for the growth of bacteria with an unlimited supply of nutrients says that after t hours an initial population of p0 will have grown to p0e1.4t. Write a Java application that calculates the growth of a colony of bacteria. As usual get the value of p0 and t from the command line.
Modify the bacteria growth program so that the time can be input in minutes. Note that the formula still requires a time in hours.
Carbon dating is used to estimate the age of once living objects according to the following formula:
Write a Java application that calculates the age of an object given the percentage of carbon 14 remaining.
Put the VeryLong and Rational classes of the Exercises in Chapter 7 into your own package.