How to create a calculator?

2 Ansichten (letzte 30 Tage)
Johnny Boy
Johnny Boy am 7 Dez. 2014
Beantwortet: Star Strider am 7 Dez. 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 Kommentar
John D'Errico
John D'Errico am 7 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 7 Dez. 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!

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by