Hello,
I am playng with a simple
java program which when started the user is asked to enter a number than an arthimetic operator +,-,*,/ than again a number
and at the and to display the result depending on the operator used in the process...
I managed to do this but only when the operator is hardcoded :
import java.io.*;
public class kalkulacijaZbirDvaBroja
{
public static void main(
String[] args)throws IOException
{//citanje i unos prvog broja
BufferedReader stdin = new BufferedReader (new
InputStreamReader(System.in));
String first, second;
int firstNum, secNum, sum;
//Citanje prvog korismickog unosa
System.out.print("Unesi prvi broj :");
first = stdin.readLine();
firstNum = Integer.parseInt(first);
//Citanje drugog korisnickog unosa
System.out.print("Unesi drugi broj :");
second = stdin.readLine();
secNum = Integer.parseInt(second);
//Kalkulacija unesenih brojeva
sum = firstNum + secNum;
System.out.println("rezultat je :" + sum);
}
}
Thank you !
edo