3. Explain the output of this program

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

3. Explain the output of this program

 

Run
O Debug
I Stop
E Share
A Save
{ } Beautify
上
Language Java
Main.java
7
8.
9 import java.util.*;
10 public class Main
{
11
public static void main(String[] args)
12
{
Scanner inputInstance = new Scanner(System.in);
//Taking user inputs
System.out.println("Please enter total miles driven : ");
double milesDriven = inputInstance.nextDouble();
System.out.println("Please enter gallons of gas used : ");
double gallonsofGasUsed = inputInstance.nextDouble();
System.out.println('
System.out.println('\n');
13
14
15
16
17
18
19
");
20
input
Please enter total miles driven :
1500
Please enter gallons of gas used :
5
Car's miles per gallons = 300.0
Transcribed Image Text:Run O Debug I Stop E Share A Save { } Beautify 上 Language Java Main.java 7 8. 9 import java.util.*; 10 public class Main { 11 public static void main(String[] args) 12 { Scanner inputInstance = new Scanner(System.in); //Taking user inputs System.out.println("Please enter total miles driven : "); double milesDriven = inputInstance.nextDouble(); System.out.println("Please enter gallons of gas used : "); double gallonsofGasUsed = inputInstance.nextDouble(); System.out.println(' System.out.println('\n'); 13 14 15 16 17 18 19 "); 20 input Please enter total miles driven : 1500 Please enter gallons of gas used : 5 Car's miles per gallons = 300.0
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Print statement
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT