I am attempting to program a very basic calculator. The program simply needs to prompt the use to input the computation i.e. 2 * 5
The program needs to compute this and display the result as "The result is: 10"
I think my problem comes when I need to tell java to compute the users input. I do not know what function or method I need to use. If anyone can help I would appreciate it.
Thanks
This is what I have so far:
The program needs to compute this and display the result as "The result is: 10"
I think my problem comes when I need to tell java to compute the users input. I do not know what function or method I need to use. If anyone can help I would appreciate it.
Thanks
This is what I have so far:
Code:
import java.io.*;
import java.util.*;
public class Calculator
{
public static void main(String[] args)
throws java.io.IOException
{
String I;
double Input;
double Result;
double Interest;
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("What do you want to compute? ");
I = br.readLine();
Interest = Double.parseDouble(I);
Result = Math(Interest);
System.out.println("The result is: " +Result);
}
}
Comment