[Android General] mhrsolanki2020:
Chapter 2

FlowCharts​

Theory​

As Flow Chart is a graphical representation of programs, we need symbols which will help us to graphically represent it. so here they are:

Input:

The Input symbol is used when the user has to input something , in other words it denotes that user will input at this point of program.

eg: the program is about multiplying the two numbers, so the program will ask the user to input two numbers to multiply in this box, 2 and 4

Processing:

The Processing symbol is used to show that there will be some processing in the program now.

eg: after the two numbers are accepted, the process of multiplication is shown in this box. 2 * 4

Output:

The result after processing is done, ie after the two numbers are multiplied , the output is given to the user by this symbol.

eg: 2 * 4 = 8

Decision:

Some times , its essential for the program to make decisions, this can be achieved with the use of this symbol

eg: If you want the user to input two numbers two multiply, but both the numbers should be less then 5, here u can check if the user has given input as per that , if yes then the program will execute(do the work) the way u code for yes, if no then you have to code a different set of code or re run the program.

Subroutine:

This is usefull when you have a big program , you can make different flow charts and then add them together.

Flow Lines:

These are the Lines That will decide where your program will go .

Terminator::

It is like a start for each flowchart, and also the end of flowchart. Also known as Entry point of flow chart and Exit point of flochart.

On page connector:

When your program has the decision boxes, and different conditions satisfy in a different way and end up in a place is where you would use On page connector.

Off page connector:

When your program exceeds the page, and you continue it on some other page then we use Off page connector.

Annotation:

It is a type of comments, which you write for other developers if the part/logic of the part of your program is hard.

================================================== ================================================== ================================================== ==================================================

Practical
​

Lets take an example, that a friend of your asks u to make a program on how to make a tea.

n u say ya ok bro, i will make a flow chart n will send it to you.

so here is the flow chart that you would make

So heres the first flow chart .

lets discuss it in detail (remember the red numbers are just so that you know what i am talking about, u need not write it while drawing flowcharts).

1. It is the terminator. It denotes that your program has started

2. It is the annotation, it is just for the reference of the reader. it is as good as an comment.

3. It is an input box, asks the user to input water, sugar , tea leaves and milk

4. It is an processing box, in this box processes takes place, in this case it is boiling the milk.

5. It is an output box, it tells that the tea is prepared.

6. It is an terminator. It denotes that your program has ended.

================================================== ==================================================*

Lets Take another example:

Suppose i ask you to make a flow chart of how do users register them self at Xda-developers.com.

How would u make it?

Something like this:

So , as you can see,

The terminal is starting the program, then the user inputs his details that are neccesary for signing up(in input box). then those details are stored in the xda developers database(in processing box) , and then the output box shows that you are registered sucessfully..

================================================== ==================================================*

So after seeing two flowcharts i guess you got a better understanding of what flowchart is all about..

So the flowcharts start with a start terminal. and ends with stop terminal. And then there are input boxes for taking inputs and processing boxes for processing the input and there is an output box for output.

So far we learned how to use:

1) Terminator

2) Input Box

3) Processing Box

4) Output Box..

Lets Give you guys an Exercise... At the end of this Post i will put it up.

Now before we move on to use the Decision Box i would like to Show you one more simple flow chart (and if you dont understand it , then i guess i am going too fast in my teaching.. lemme know if you dont get it , pm me or mail me )[/I]

================================================== ==================================================

Decision Box​

So while in a program sometimes you have to make decisions.

Decisions like if the user input is right or wrong, username is less than 16 character, password is atleast 6 character etc etc.

This is when you use Decision Box in flow chart.

It is used as follows

When the user is signing up in xda-forum . this is the decision box used after the password is accepted.

It checks , "Is the password greater than 6 characters?, if yes then run so and so codes, if no then run so and so codes" The flow line of Yes have different set of codes. The flow line of No have different set of codes.

For eg:

as you can see , in the decision box, if the Username is greater than 16 characters it shows an error and then runs the program again from where the flow line indicates. If the user name is not greadter than 16 characters then it runs the program normally

Exercise::

Draw FlowCharts For the following programs:

1) To Add two numbers.

2) To multiply the numbers

3) Add two numbers which are single digit only and show appropriate error if user inputs a two digit number

(Hint: Use the decision box to check "is number1 < 10" as if the number will be less than 10 then it will be a single digit number , (we exclude the posibility of negative numbers for sake of simplicity , though will teach you to tackle it in the next chapter))​

4) Add the two numbers and subtract the addition with their product (eg if the user inputs 2 and 3 , then in processing box write (2*3)-(2+3) )

This Fourth one is important , plz do not skip it as we will discuss on it in next chapter.

Do it on a paper or in book.

mail me at c.helpline2020@gmail.com your scaned copy or a photo of your flowchart if you want to .. i will see each of them

Or Check From The answers Below.

Answers:

1) Answer

2) Answer

3) Answer

4) Answer