Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started