A method called gallonsToLiters, which takes a single double parameter called gallons and returns a long.

computer science

Description

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.

Instruction Files

Related Questions in computer science category