1  import java.util.Scanner;
  2  
  3  /**
  4     This program prints the total volume of a number of bottles and cans.
  5  */
  6  public class Volume2
  7  {
  8     public static void main(String[] args)
  9     {
 10        final double BOTTLE_VOLUME = 2;
 11        final double LITER_PER_OUNCE = 0.0296;
 12        final double CAN_VOLUME = 12 * LITER_PER_OUNCE;
 13  
 14        // Display prompt
 15  
 16        System.out.print("Please enter the number of bottles: "); 
 17  
 18        // Read number of bottles
 19  
 20        Scanner in = new Scanner(System.in);
 21        int bottles = in.nextInt();
 22  
 23        // Start the computation of the total volume
 24  
 25        double totalVolume = bottles * BOTTLE_VOLUME;
 26  
 27        // Read number of cans
 28  
 29        System.out.print("Please enter the number of cans: ");
 30        int cans = in.nextInt();
 31  
 32        double additionalVolume = cans * CAN_VOLUME;
 33  
 34        // Update the total volume
 35  
 36        totalVolume = totalVolume + additionalVolume;
 37  
 38        System.out.print("Total volume: ");
 39        System.out.println(totalVolume);
 40     }
 41  }