0% found this document useful (0 votes)
3 views

U4A1AST Algorithm Flowchart

The document outlines a flowchart for debugging and validating user input through multiple stages. It includes conditions for checking input length, character content, and integer values, guiding the user through prompts until valid input is received. The flowchart also specifies actions for invalid inputs and options to restart or exit the program.

Uploaded by

tharan.eshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

U4A1AST Algorithm Flowchart

The document outlines a flowchart for debugging and validating user input through multiple stages. It includes conditions for checking input length, character content, and integer values, guiding the user through prompts until valid input is received. The flowchart also specifies actions for invalid inputs and options to restart or exit the program.

Uploaded by

tharan.eshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Flowchart: Debugging and Validating Data

Output "Your input is input.length() Output "Your input is not a False True True
False True input < 0? Output "Invalid input. False Key "x" or "X" Output a farewell
not greater than six >6 negative number" Please try again." entered? message to the user.
characters." characters?

input.length()
Output "Your input is not False True
<= 15 AND False
between 5 and 15 False
input.length()
characters"
>= 5?
Store the string in Output "You chose to
Output "Your input is True Parsing error Key "p" or "P" True
the variable "input" restart the program. Set exit = true
not an integer" caught? entered?
False Welcome back!"

Output "Your input True Input contains


Output "Stage 1:" and
contains the letter Z" the letter "Z"?
prompt the user to enter a Store the string in
string greater than six Try to parse the string Set exit = false
the variable "input"
characters "input" to an integer

Store the string in Prompt the user to


Declare a while loop the variable "input" Store the string in enter [P] to play again
that repeats until the the variable "input" or [X] to exit
user enters a valid
input

Output "Stage 3:" and


prompt the user to enter an Declare a while loop
Give the user input between five and Output "Stage 5:" and that repeats until the
instructions on fifteen characters that prompt the user to enter a user enters a valid
progressing through doesn’t contain the letter “z” negative integer input
each stage of the
program

Declare a while loop


that repeats until the Declare a while loop Output a
that repeats until the congratulatory
Give a welcome user enters a valid
input user enters a valid message to the user
message to the user
input

Create a do while Call the method Call the method Call the method Call the method Call the method Call the method Call the method "ending" that
Initialize the boolean loop repeating the "stageOne" to "stageTwo" to "stageThree" to "stageFour" to "stageFive" to "stageSix" to execute receives and returns the boolean
Start End
variable "exit" to true program while exit = execute the first stage execute the second execute the third execute the fourth execute the fifth stage the sixth stage of the "exit" to prompt the user to restart
false of the program stage of the program stage of the program stage of the program of the program program or exit the program.

Declare a while loop


Declare a while loop Declare a while loop that repeats until the
that repeats until the that repeats until the
user enters a valid
user enters a valid user enters a valid input
input input

Output "Stage 6:" and


Output "Stage 2:" and Output "Stage 4:" and prompt the user to
prompt the user to enter a prompt the user to enter a positive, odd
string containing at least enter an integer integer
one lowercase "a" between 5 and 500

Store the string in


Store the string in the variable "input"
Store the string in the variable "input"
the variable "input"

Try to parse the string


Try to parse the string "input" to an integer
"input" to an integer
Output "Your input
does not contain at False input.contains True
least one lowercase ("a") ?
a"
Output "Your input is True Parsing error
Output "Your input is True Parsing error
not an integer" caught?
not an integer" caught?

False
False

Output "Your integer input >= 5 Output "Your integer False


False True input > 0?
is not between 5 and AND input <= is not positive"
500." 500?

True

Output "Your integer False True


input%2 = 1?
is not odd"

You might also like