Answer:
import java.util.Scanner;
public class num7 {
 public static void main(String[] args) {
 Scanner in = new Scanner(System.in);
//Prompt and receive user input
 System.out.println("enter miles/gallon");
 double milesPerGallon = in.nextDouble();
 System.out.println("enter dollars/gallon");
 double dollarsPerGallon = in.nextDouble();
 //Finding Dollars Per Mile
 // Given One gallon = 20 mile One gallon = 3.1599 dollars
 double dollarsPerMile = dollarsPerGallon / milesPerGallon;
 System.out.println("Cost in dollars per mile is "+dollarsPerMile);
 double tenMiles = 10*dollarsPerMile;
 double fiftyMiles = 50*dollarsPerMile;
 double fourHundreMiles = 400*dollarsPerMile;
 System.out.println(tenMiles+" "+ fiftyMiles+" "+fourHundreMiles);
 }
}
Step-by-step explanation:
- Solve with Java programming language
- Use Scanner class to receive user values for miles/gallon and gas dollars/gallon instead of hard-coding the values given (20.0 3.1599)
-  Find the cost in dollars Per Mile given that One gallon = 20 miles and One gallon = 3.1599 dollars
- Calculate for 10 miles, 50 miles and 400 miles