How to create a calculator?

12 views (last 30 days)
Johnny Boy
Johnny Boy on 7 Dec 2014
Answered: Star Strider on 7 Dec 2014
I'm trying to figure out how to program a user-friendly circuit calculator. It will be a basic series circuit (2 windows, with 1 resistor on the top of each window and 1 on each side at a maximum, so up to 4 resistors can be chosen). The user should be able to specify the number of resistors AND each of their values so ultimately the total resistance can be calculated. So far I have: menu('Number of resistors', '1', '2', '3', '4'). Clicking the number of choice indicates the user's number of resistors. Then, he/she would type in the values of those x number of resistors (no more than 4) so they can receive a calculation of the total resistance. The total resistance would be R1+R3+R3+R4 (if the user chooses 4 resistors). If they choose three, it would be R1+R2+R3.
  1 Comment
John D'Errico
John D'Errico on 7 Dec 2014
So what is your question? That you WANT to do something is good. But there really is no way we can help you from what you have said. START WRITING. If we write something for you, you gain nothing.
You say that so far, you have ONE basic line of code. So spend some time thinking. What is your next step? How would you implement that? Try something. If it does not work, then read the help. Figure out why. It is that effort on your part that gives you a gain.
In the end, the goal is for you to learn programming, so that perhaps eventually you can use that skill to build something useful.

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 7 Dec 2014
It seems that you want to create a GUI for your calculator. The best way to approach this is to start with guide. Take your time, experiment with it, and have fun!

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!