can anyone help me to construct the code:
i dont know how to make the code of entering the operator ,the function of the operator when it was input and the output of the result .
limit of the result is 500,

Enter First Number:2
Enter Second Number:6
A=+ || a=+ S=- || s=-
M=* || m=* D=/ || d=/
Choose Operator:A ||a
Result:?

Member Avatar for coil

Use an if statement.

String selection=<scanner>.next();

if(selection.equalsIgnoreCase("a") System.out.println(num1+num2);
etc.

Can you help me to complete the code for this?
The result should be in words.
And wether 'A' or 'a' will be ok when you input the operator.

this was the given:

Enter First Number:8
Enter Second Number:9
M=* || m=* D=/ || d=/
A=+ || a=+ S=- || s=-
Enter Operator:m
Result:seventy-two // the result should depend on what operator you choose.

please check if there is more code to change and there is a lot missing code..please complete my code if you know...thank you so much!!!

import java.io.*;
public class Casestudy {
public static void main(String[] args) throws IOException {

BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));


System.out.println("Case Study Number 1");

System.out.print("Enter number 1:");
int num1=Integer.parseInt(stdin.readLine());

System.out.print("Enter number 2:");
int num2=Integer.parseInt(stdin.readLine());

System.out.println("A=+");
System.out.println("S=-");
System.out.println("M=*");
System.out.println("D=/");

System.out.print("Enter Operator:");
int operator=Integer.parseInt(stdin.readLine());

}
}

Member Avatar for coil

Did you try what I suggested above?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.