Question: import java.util.Scanner; public class Difference { /* Your code goes here */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in); double a1;

import java.util.Scanner;
public class Difference {
/* Your code goes here */
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double a1;
double b1;
a1 = scnr.nextDouble();
b1 = scnr.nextDouble();
printDifference(a1, b1);
}
}
Define a method printDifference() that takes two double parameters, and outputs "Result followed by the result of subtracting the first parameter by the second parameter with a precision of one digit as follows, ending with a newline Ex: If the input is 8.0 24.0, then the output is: Result: -16.0 Note: The calculation to find the difference of two values x and y is (x-y). Use System.out.printf("%.1f", myDouble) to output doubles with precision of one digit.
Step by Step Solution
There are 3 Steps involved in it
Differencejava Java program to read two double values and display the ... View full answer
Get step-by-step solutions from verified subject matter experts
