Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Java How do I add exponents and parentheses to my code?

SHjiwani

New Coder
This is the pastebin for my code: pastebin.com/gV01kTje

Basically I have an assignment where I need to create a calculator capable of up to 3 step equations and being able to do all PEMDAS operations in PEMDAS order. So far I've gotten it up to 3 step operations and being able to do addition, subtraction, multiplication, and division in PEMDAS order, but I don't know where I would even start with trying to implement parentheses and exponents into my code. Can someone ease help me out?
 
Maybe try search for a parenthesis or power first, identify first things to do as separate equations and simplify.
Do things in order, identify most inner first and start removing parentheses sets.
Do things with precedence: parentheses, power, multiply and divide, add and subtract.
Just try for doing inner first and in that order.
If you did multiply first before add this should be easy.
X E.
 
Back
Top Bottom