Question: Write two methods that will make the following code work: import java.util.Scanner; public class Calculator { public static void main(String [] args) { double total,

Write two methods that will make the following code work:

 import java.util.Scanner; public class Calculator { public static void main(String [] args) { double total, num1, num2 = 0; Scanner kb = new Scanner(System.in); System.out.println("Enter number 1"); num1 = kb.nextDouble(); System.out.println("Enter number 2"); num2 = kb.nextDouble(); total = addNumbers(num1, num2); System.out.printf("%.2f + %.2f = %.2f", num1, num2, total); total = subtractNumbers(num1, num2); System.out.printf(" %.2f - %.2f = %.2f", num1, num2, total); } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!