Create a class and, in this class, create two static methods:
1. A method called gallonsToLiters, which takes a single double parameter called gallons and returns a long. The method should simply return the number of liters (rounded) corresponding to the number of gallons given as the method argument. The method should return -1 if the gallons argument is less than 0.
2. A main method to demonstrate your gallonsToLiters method. Use the gallon values given below.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
426 Experts Online