how to Create a flowchart that will perform the multiplication, addition, subtraction and division of two numbers. First, the two numbers are given by the user. Then, given the two numbers, the 4 operations are performed. Lastly, it will display the results of the four operations. (Make use of valid variable names. Check our class reference for the description of a “valid” variable name).
@e.mccormick help,,,
OK, do you know the shapes to use in flowcharting?
yeah
OK, so first use a decision tree to find the variables and the operation to be used. Have it loop through itself, or branch, until it finds all three inputs. Then, based the math operation given, do the operation needed.
Your yes/no things can be things like: Is it a number. Is it a math operator. If you get no to both you go to an error report to the user and end. If it is a yes to one, you find out if you already have both variables, and so on.
after the decision what is the next step to do?
It is not one decision. It is a chain of them. What you do after each depends on the results. Once you have both variable and the operator, you need to go to processing the input properly. So lets say one of your things is, "Is it a math operator in the list /*-+." And the answer is yes. Then you set the math operation to that character. Well, later, based on the character you do the proper operation.
Actually, this time it is asking for all four operations.
So you really just need to have it prompt for the numbers. Takre them in. Do the math. Output the results.
uhhh ok...
I was thinking more like a calculator, but this question is saying " two numbers are given by the user" and "display the results of the four operations" That means you have far less choices to wory about.
IKR... but its still confusing
Well, think about how you would do this in real life if you could only do one thing at a time. So, you ask a person for a number. You write down what they tell you. You ask them for a second number. You write down what they tell you. Then you do one type of math with the two number and tell them the result. Then you do the next type and tell them the result. Etc. until you have done all four of multiplication, addition, subtraction and division of two numbers. Then you tell them you are done. You just need to flowchart something similar to that process.
so thats the ask how to make flowchart of it.........
That is the whole thing in non-flowchart form. You just need to do that as a flowchart.
thanks :)
np. Don't have too much fun with it. The important part with these is reading the question really well. When I first started talking about this, I had only glanced at it. So I started looking at doing too much! Then I read it, and made it a lot simpler. Reading a question fully like that can make a huge difference!
thank you sa advice :)
CS111
@e.mccormick still i dont know how to graph this one.
Well, it gets two number from the user, like the other one. But after that, it just does a little math and finally outputs the results of that math.
Start Input two variables Do math and assign results to more variables. Output the 4 results. End.
ok i'll try it thanks :)
np. Part of the reason for these diagrams is to make you get used to breaking things into smaller parts. Programming is all about taking big jobs and making them into lots of small jobs.
yeah you have a point.
wooooh >.< its still confusing when its come in the "Do math and assign results to more variables"
i dont know what to ask in the decision
"perform the multiplication, addition, subtraction and division of two numbers" So is is just the first times the second, first plus the second and so on. You do all four. No more asking.
"Then, given the two numbers, the 4 operations are performed." All four. No choices there.
can you draw??? so that i can easily understand ? if it is ok for you. :)
"Make use of valid variable names." So it needs to save the results in a valid variable. "Lastly, it will display the results of the four operations. " and then it finally dispalys things.
Those thing earlier are an overview of the boxes. One line per box: Start Input two variables Do math and assign results to more variables. Output the 4 results. End. So you need to draw the right shape for input. Type/Write in the proper stuff for input. Go to the next box. Do a line for each calculation and have it assigned to a variable. Go to the next box. Output the results.
|dw:1381739102394:dw|
Join our real-time social learning platform and learn together with your friends!