title: 2 method Exception in thread "main" java.util.NoSuchElementException
body: <p>I keep getting the Exception in thread "main" java.util.NoSuchElementException error message. I have tried switching stuff around, but I keep having this problem</p>
  
  <p>I have tried declaring the variables in different methods, but nothing is seeming to work. </p>
  
  <pre><code>import java.util.Scanner;
  
  public class LabProgram {
  
      public static double drivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon) {
          double totalCost = (drivenMiles / milesPerGallon) * dollarsPerGallon;
          return totalCost;
      }
  
      public static void main(String[] args) {
          double milesG;
          double dollarsG;
          Scanner scnr = new Scanner(System.in);
          milesG = scnr.nextDouble();
          dollarsG = scnr.nextDouble();
          drivingCost(10.0, milesG, dollarsG);
          milesG = scnr.nextDouble();
          dollarsG = scnr.nextDouble();
          drivingCost(50.0, milesG, dollarsG);
          milesG = scnr.nextDouble();
          dollarsG = scnr.nextDouble();
          drivingCost(400.0, milesG, dollarsG);
      }
  }
  </code></pre>
  
  <p>The problem is:</p>
  
  <p>Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975. </p>
  
  <p>Define that method in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your drivingCost() method three times. 
  Output each floating-point value with two digits after the decimal point.</p>
  
  <p>The input is: 20.0 3.1599</p>
  
  <p>Expected output: 1.58 7.90 63.20</p>