Plssss someone help me in JAVA?
I have the code here name the file as ifmdas.java:
(the code is)

import java.io.*;
public class ifmdas{
public static void main(String[] args) throws IOException{
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
String option, firstnum, secondnum;
int num1, num2, prod, quo, sum, diff, choice;

System.out.print("Choose An Operation");
System.out.print("\nPress1 for Multiplication");
System.out.print("\nPress2 for Division");
System.out.print("\nPress3 for Addition");
System.out.print("\nPress4 for Subtraction");
System.out.print("\n\nOperation: ");
option=stdin.readLine();
choice=Integer.parseInt(option);

if(choice==1){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
prod=num1*num2;
System.out.print("\nThe product is: "+prod);
}else if(choice==2){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
if(num2==0){
System.out.print("cannot perform the operation");
}else{
quo=num1/num2;
System.out.print("\nThe quotient is: "+quo);
}
}
else if(choice==3){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
sum=num1+num2;
System.out.print("\nThe sum is: "+sum);
}
else if(choice==4){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
diff=num1-num2;
System.out.print("\nThe diference is: "+diff);
}
}
}

i wanna have now the option that uses only big and small characters ( M,D,A,S) and (m,d,a,s) i think this one will use bool character but I didn't know how to do the bool
so please someone recode this java file plsss help

At line 15, instead of converting the input to int, just leave it as a String.
In lines 17, 26 etc just test if the String is equal to "M" or "m" etc.
ps: You can't compare Strings with ==. You need the equals("M") method, or, even better, equalsIgnoreCase("M") which deals with m as well as M

If I understood correctly you want the user to enter characters?
Then you already have the code:

option=stdin.readLine();

All you have to do is check the "option":

if (option.equalsIgnoreCase("M")) {

}

At line 15, instead of converting the input to int, just leave it as a String.
In lines 17, 26 etc just test if the String is equal to "M" or "m" etc.
ps: You can't compare Strings with ==. You need the equals("M") method, or, even better, equalsIgnoreCase("M") which deals with m as well as M

the code that you made was so helpful
the last problem is

is it also valid if I consider that only (M,D,A,S) or (m,d,a,s) will only be the input?
because what i want is if it is not (M,D,A,S) or (m,d,a,s) says it's not valid.

I'm not familiar yet on the structure of multiple condition statement in just single block...
maybe if you cannot understand can you validate and revise this code???

if(choice!=M,D,A,S || m,d,a,s){
System.out.print("the input is not valid");
}

in this way I want only M, m, D, d, A, a, S and s
are the only valid inputs

If I understood correctly you want the user to enter characters?
Then you already have the code:

option=stdin.readLine();

All you have to do is check the "option":

if (option.equalsIgnoreCase("M")) {

}

my last problem was this
the code that you made was so helpful
the last problem is

is it also valid if I consider that only (M,D,A,S) or (m,d,a,s) will only be the input?
because what i want is if it is not (M,D,A,S) or (m,d,a,s) says it's not valid.

I'm not familiar yet on the structure of multiple condition statement in just single block...
maybe if you cannot understand can you validate and revise this code???

if(choice!=M,D,A,S || m,d,a,s){
System.out.print("the input is not valid");
}

in this way I want only M, m, D, d, A, a, S and s
are the only valid inputs

You test all the valid options already - if ( ) ... else if (...) .. etc so if you put a final else at the end that will only be executed if all four previous tests failed - ie is the input was invalid.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package com.sanah;

/**
*
* @author Dharma
*/
import java.io.*;
public class ifmdas{
public static void main(String[] args) throws IOException{
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
String option, firstnum, secondnum;
int num1, num2, prod, quo, sum, diff, choice;

System.out.print("Choose An Operation");
System.out.print("\nPress M for Multiplication");
System.out.print("\nPress D for Division");
System.out.print("\nPress A for Addition");
System.out.print("\nPress S for Subtraction");
System.out.print("\n\nOperation: ");
option=stdin.readLine();
//choice=Integer.parseInt(option);

if(option.equalsIgnoreCase("M"))
{
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
prod=num1*num2;
System.out.print("\nThe product is: "+prod);
}else if(option.equalsIgnoreCase("D")){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
if(num2==0){
System.out.print("cannot perform the operation");
}else{
quo=num1/num2;
System.out.print("\nThe quotient is: "+quo);
}
}
else if(option.equalsIgnoreCase("A")){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
sum=num1+num2;
System.out.print("\nThe sum is: "+sum);
}
else if(option.equalsIgnoreCase("S")){
System.out.print("\nEnter the first number");
firstnum=stdin.readLine();
System.out.print("\nEnter the second number");
secondnum=stdin.readLine();
num1=Integer.parseInt(firstnum);
num2=Integer.parseInt(secondnum);
diff=num1-num2;
System.out.print("\nThe diference is: "+diff);
}
}
}

Comments
Purposeless, no Code Tags, hand in solution, no additional contrubution when answerS have been given
This article has been dead for over six months. Start a new discussion instead.