You are on page 1of 4

TBE540

PseudocodetoFlowchartExercise
Usethepseudocodetomakeaflowchartforthefollowingprogramdescriptions.
Usetheseflowchartingsymbols:
START/END

PROCESS

INPUT/OUTPUT

DECISION

Program1
Theprogramwill(1)askfortheusersname,then(2)printHIandthename.The
programwillthen(3)askwhatyeartheuserwasborn,(4)calculatetheage,and(5)print
theage.(6)Ifthestudentisover21,theprogramwill(7)printYOUAREANADULT!
PSEUDOCODE
START
(1)Getname

(2)PrintHIandname

FLOWCHART
START
Getname

(3)Askyearborn
(4)Calculateage
(5)Printage
(6)Age>21?
(7)IfY,printmessage
END

Program2
Theprogramwill(1)choosetworandomnumbers,then(2)printthemoutasanaddition
problem.Theprogramwillthen(3)asktheuserto(4)enterthecorrectanswer.(5)Ifthe
answeriscorrect,theprogramwill(6)printRIGHT.(6)Iftheansweriswrong,the
programwill(7)printNO,THEANSWERISandthecorrectanswer.
PSEUDOCODE
START
(1)Calc.tworandomnumbers
(2)Printadditionproblem
(3)Printmessage(ENTERANSWER)
(4)Waitforinput
(5)Answercorrect?
(6)IfY,printRIGHT
(7)IfN,printNOTHEANSWERIS+
correctanswer.
END

FLOWCHART
START

Calc.2
randomnum.

Program3
Thegoaloftheprogramistotakeinseveralnumbersandprinttheaverage.Eachnumber
willcomeinoneatatime.Eachtimeanumbercomesin,thecomputerwillhavetoaddit
totherunningtotalandaddonetothenumberofnumberssotheaveragecanbe
calculated.Thisprocesswillneedtoberepeateduntiltheuserisfinishedenteringallthe
numbers.Attheend,theaveragemustbecalculatedandprinted.Therewillhavetobea
wayforthecomputertotellwhetherornotthereisanothernumbercominginorwhether
itshouldprinttheaverage.NOTE:Youcanshowlooping(repeating)onaflowchart
orthepseudocodebyjustdrawingalinewithanarrow.
Brainstormonthestepsneededtomakethishappen.Writethepseudocodeand(ifyou
dare)trytheflowchart.
PSEUDOCODE
START

FLOWCHART
START

You might also like