Get in touch with us
Send us an e-mail
Question
This problem implements a simple calculator using RPN notation. The application will consist of user input, stack operation, and displaying the result. RPN calculations work in conjunction with a stack. Every time a user enters a number, the number should be pushed on the stack. When the user enters a function, the top element or elements of the stack are used in the calculation and the result is placed on the stack.
a) Create a MATLAB class that implements a stack with the following methods: Push, Pop, is Empty, GetContents, and a constructor. The GetContents method is needed to display the elements of the stack.
b) Write a script that will take user inputs as strings and perform the following operations:
i) If the user enters a number, push it on the stack. A function needs to be written to determine if a string is valid number. The function is strprop is a good starting point.
ii) If the user enters a string, treat it like a function and evaluate it using the number on the top of the stack, and push the result on the stack. The only functions allowed are +,-,*,/, sin, cos, tan, and exp. The calculator should also support the following constants: pi and e. Look into the switch statement.
c) Always display the contents of the top 3 elements of the stack prior to asking for input.
Example: 2: 0
1: -1.03
0: 2.2
>Input>>>>
d) Run the code with the following inputs. Show the stack after each step.
i) 2 2 + 3 *
ii) pi 2 / sin
iii) 2 4 + 2 / exp
iv) 2 3 4 + *
Summary
This question belongs to MATLAB software and discusses about application of MATLAB in operations management and to write a script that will take user inputs as strings and perform the given operations.
Download Full Solution
I was badly stuck while preparing my patient report assignment help and had no clue on how to incorporate all the minute details into the entire perspective. Luckily then only one of my friends suggested that HwA is the best place to get original work done and he was absolutely right. From the moment I contacted them I became certain that these people know the stuff and then they helped me deliver a brilliant patient report fetching me excellent grades in my class. It also taught me on how to write patient reports.
The topic I had selected for my dissertation required to include a report on the local markets of New South Wales. It was difficult getting help online as the data available are mostly generic and difficult to understand cohesively. Moreover, the majority of the online dissertation writing services online are located abroad somewhere in USA or UK. I was happy to see that HwA has dissertation writing helpers from not only Australia, but New South Wales itself and they cater specifically to students like us, who are from or studying in Australia.
My main concern was the research that needed to be done for the human resources assignments for my undergraduate program. Keeping up with the course load and assignments from the other professors I was having a tough time. With TheReliableTutor, the tutors help out with the research saving my time and assisting me in submitting well researched and balanced assignments.
1. Process control assignments in chemical engineering were a very difficult challenge for me. I was totally unsure about the application of laplace transform and differential equation in chemistry. Then I came across HwA and their experts are truly knowledgeable. She helped me with my assignments and showed, actually how easy it is.
I always trust TheReliableTutor as they have always provided the required support and assistance. By assistance, I mean, they do not disappear after providing one accounting homework help but stay in touch for clarifying minor doubts and as a student I find it to be a very lucrative deal.
Comments
this is a very good website
I have 50 questions for the same test your page is showing only 28
hi can you please help or guide me to answer my assignments. thanks
hi can anyone help or guide me to my assignments. thanks
This solution is perfect ...thanks
Hello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes
Perfect bank of solution.
great !
thanks for the quick response. the solution looks good. :)
thnx for the answer. it was perfect. just the way i wanted it.
works fine.