Java Reference
In-Depth Information
Write a test program that invokes these methods to display the following tables:
Celsius
Fahrenheit
|
Fahrenheit
Celsius
40.0
104.0
|
120.0
48.89
39.0
102.2
|
110.0
43.33
...
32.0
89.6
|
40.0
4.44
31.0
87.8
|
30.0
-1.11
6.9
( Conversions between feet and meters ) Write a class that contains the following
two methods:
/** Convert from feet to meters */
public static double footToMeter( double foot)
/** Convert from meters to feet */
public static double meterToFoot( double meter)
The formula for the conversion is:
meter = 0.305 * foot
foot = 3.279 * meter
Write a test program that invokes these methods to display the following tables:
Feet
Meters
|
Meters
Feet
1.0
0.305
|
20.0
65.574
2.0
0.610
|
25.0
81.967
...
9.0
2.745
|
60.0
196.721
10.0
3.050
|
65.0
213.115
6.10
( Use the isPrime Method ) Listing 6.7, PrimeNumberMethod.java, provides the
isPrime(int number) method for testing whether a number is prime. Use this
method to find the number of prime numbers less than 10000 .
6.11
( Financial application: compute commissions ) Write a method that computes the
commission, using the scheme in Programming Exercise 5.39. The header of the
method is as follows:
public static double computeCommission( double salesAmount)
Write a test program that displays the following table:
Sales Amount
Commission
10000
900.0
15000
1500.0
...
95000
11100.0
100000
11700.0
 
 
Search WWH ::




Custom Search