Question: Define a method convertVolume() that has two integer parameters as the number of gallons and quarts. The method returns a double as the volume converted
Define a method convertVolume() that has two integer parameters as the number of gallons and quarts. The method returns a double as the volume converted to liters, given that: 1 quart = 0.946353 liters 1 gallon = 4 quarts Ex: If the input is 2 11, then the output is: Result: 17.981 liters
Define a method convertVolume() that has two integer parameters as the number of gallons and quarts. The method returns a double as the volume converted to liters, given that: . 1 quart = 0.946353 liters . 1 gallon = 4 quarts Ex: If the input is 2 11, then the output is: Result: 17.981 liters 1 import java . util. Scanner; public class VolumeConversion { YOUOWNP V* Your code goes here */ public static void main(String args) { 8 Scanner scan = new Scanner (System. in) ; 9 int numGallons; 10 int numQuarts; 11 12 numGallons = scan. nextInt(); 13 numQuarts = scan. nextInt(); 14 15 // Print with value rounded to 3 decimal places 16 System. out . printf("Result: %.3f liters\ ", convertVolume(numGallons, numQuarts) ); 17 18Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
