Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions