Policy: Please answer the following questions in a single post. Number your answ
ID: 441550 • Letter: P
Question
Policy: Please answer the following questions in a single post. Number your answers (e.g. Ans1, Ans 2 etc.) so that I know which answer belongs to which question. A single comprehensive post answering all the questions is sufficient. But I strongly encourage the students to read the all posts made by the other students so that you can learn from them and also see my comments in these posts. It will help if you access these posts at least every other day to see if you any student, or I made given any tips. Learning from these conference posts will also help you with home work and projects. Please provide a single comprehensive answer to the questions below and number your answers as Ans 1a, Ans 1b, Ans 2 etc. Q 1. Create your own While-End (or For-End) repetition structure that includes a nested if-then selection structure. You can choose any example of your choice. Please provide: a. Explanation of your example in simple sentences. b. Pseudocode of your example. c. Flowchart of your example. Q 2. Given the following pseudocode for a While-end structure Declare Age as Integer; Set Age = 1; While Age < 100 WriteExplanation / Answer
1 a)
The while .. end structure with nest if .. else blocks format will look like.
while(condition)
{
if(condition)
{
//statements
if(Condition)
{
//statements
}
else
{
//statements
}
}
else if(condition)
{
//statements
if(Condition)
{
//statements
}
else
{
//statements
}
}
else
{
//statements
if(Condition)
{
//statements
}
else
{
//statements
}
}
}
example :Let s take a simple example..this exampe will decide grade for "n" student using mark obtained and also give comments to student as per there mark.
Here is the psoudo code.
1 :- Enter the value of n
2 :- while(count > n)
2.1 :- Enter mark;
2.2 :- if(mark > 80) then
2.2.1 :- Grade ="A"
2.2.2 :- if(mark >=90 and <=100)
2.2.2.1 : print You have done great
2.2.3 :- else
2.2.3.1 : print you can improve a little bit more.but still impressive.
2.3 :- else if(mark >=50 and mark <80)
2.3.1 :- Grade = "B"
2.4 :- else
2.4.1 :- Grade ="c"
3: end while
Flow chat :
Plz make an visual representation of the following flowchat..
1 :[input value for mark and no OF Students i.e (n)] -->
2 :<while n > 0>
----(NO)--->Goto 6
---(Yes)-->Goto 3
3 :<if(mark >80)> -->
3.1 : <if(mark >=90 and <= 100)>--->[Grade="A" and U have done grate]
3.2 : <if(mark < 90)>--->[Grade="A" andYou can still improve]
4 :<if (mark >= 60 and < 80)>---> [Grade="B"]
5 :<if(mark < 60)> ---> [Grade ="C"]
|
Goto Label 2.
6 : End
Declare Age as Integer;
Declare X as integer;
Set Age = 1;
While Age < 100
if( Age < 60)