Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What is the output As we are having CalculateApp public class in following code, we have to name the file Calculate App.java wherever we store
What is the output
As we are having CalculateApp public class in following code, we have to name the file Calculate App.java wherever we store it. For any query please comment on answer , i will try best to solve your issue import java.util.Scanner; // this will import Scanner class which is used for take inputs from user class Calculate //only one public class have to be there in one java file { double nl,n2; 1/here we are taking two input numbers from user inside class constructor public Calculate() { double num1, num2; Scanner reader = new Scanner(System.in); System.out.print("Enter two numbers: "); numl - reader.nextDouble(); num2 = reader.nextDouble(); assignValues (numi, num2); } //following method is called for assign values to ni&n2 which are entered by user public void assignValues (double numl, double num2) { this.nl = num; this.n2 num2; //following will print output of doMath by calling it. System.out.println(domath(nl,n2)); > public double doMath(double x, double y) return (-y); } > public class calculateApp { public static void main(String[] args) { Calculate cal - new Calculate(); ) 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