Skip to main content
deleted 4 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

thisThis solution focusfocuses on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus). if we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation? I.

If we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation?

I didn't know how to answer that question. I looked into Java Reflection, but still don't know how reflection can help me in this case. Can anyone shed some light on how I can make this design better? I

I want to allow people to add new operators, multiply and divide., and also maybe make their own definition for special operators/.

This application will take input string like "1 2 + 1 -" and output 2. because because "1 2 + 1 -" is the reverse Polish notation for (1+2)-1 = 2.

this solution focus on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus). if we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation? I didn't know how to answer that question. I looked into Java Reflection, but still don't know how reflection can help me in this case. Can anyone shed some light on how I can make this design better? I want to allow people to add new operators, multiply and divide. and also maybe make their own definition for special operators/

This application will take input string like "1 2 + 1 -" and output 2. because "1 2 + 1 -" is the reverse Polish notation for (1+2)-1 = 2.

This solution focuses on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus).

If we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation?

I didn't know how to answer that question. I looked into Java Reflection, but still don't know how reflection can help me in this case. Can anyone shed some light on how I can make this design better?

I want to allow people to add new operators, multiply and divide, and maybe make their own definition for special operators.

This application will take input string like "1 2 + 1 -" and output 2 because "1 2 + 1 -" is the reverse Polish notation for (1+2)-1 = 2.

added 130 characters in body
Source Link
Angela P
  • 299
  • 2
  • 11

this solution focus on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus). Someone asked me if if we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation? I didn't know how to answer that question. I looked into Java Reflection, but still don't know how reflection can help me in this case. Can anyone shed some light on how I can make this design better? I want to allow people to add new operators, multiply and divide. and also maybe make their own definition for special operators/

This application will take input string like "1 2 + 1 -" and output 2. because "1 2 + 1 -" is the reverse Polish notation for (1+2)-1 = 2.

this solution focus on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus). Someone asked me if we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation? I didn't know how to answer that question. I looked into Java Reflection, but still don't know how reflection can help me in this case. Can anyone shed some light on how I can make this design better? I want to allow people to add new operators, multiply and divide. and also maybe make their own definition for special operators/

this solution focus on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus). if we add another subclass under Token, is there a way that we don't need to check in processInput() what each operator is and perform the right calculation? I didn't know how to answer that question. I looked into Java Reflection, but still don't know how reflection can help me in this case. Can anyone shed some light on how I can make this design better? I want to allow people to add new operators, multiply and divide. and also maybe make their own definition for special operators/

This application will take input string like "1 2 + 1 -" and output 2. because "1 2 + 1 -" is the reverse Polish notation for (1+2)-1 = 2.

edited tags
Link
200_success
  • 145.7k
  • 22
  • 191
  • 481
Source Link
Angela P
  • 299
  • 2
  • 11
Loading