Question: Pop the top number of stackOne and top number of stackTwo and add them. Then, push the addition result into stackThree, Pop the top number of stackOne and top number of stackTwo and subtract them. Push the result of subtraction into stackThree.
Repl link: https://replit.com/@Reemax0/SpringgreenFortunateScan
That doesn’t sound like a question, are you sure this isn’t like homework or something? Also to answer your question, I don’t know, I’ve never dealt with popping elements in Java.
Welcome to the forums, @Reemax0!
You should not be posting your school/uni assignments to this forum. It’s not right to expect others to do the work for you and your tutor will not understand how to help you if you are submitting work from someone else. It is against our policy here.
Please feel free to post questions that will help you understand the building blocks of programs, but don’t post tasks again.
I’m sorry, but I already try many things.
Should I delete the post?
@Firepup650 let’s stay constructive.
@Reemax0 look at the task and write its basic actions in simple english terms, and make those simples till you are using almost java commands. This is a way to try and take a problem, decompose it and put an algorithm that does it.
To check what goes wrong, print to the console intermediate results and eventually you will find the issue in your reasoning
Nice way, thank you so much.