One strategy to allow program designers and programmer to share computational solutions is to use flowcharts.
They include a variety of symbols.
Here are some common ones. Click on each one to see its purpose.
An can be represented by a flowchart.
(Preferably) with a partner or group, complete the Worksheet.
Using any of the symbols above, draw a flowchart to represent the following algorithm:
int[] nums = {2,6,4,18,5};
for(int i = 0; i<nums.length; i++){
if(nums[i]>max){
max = nums[i];
}
}
System.out.println(max);
String word = new String("");
do{
System.out.println("Enter a 5 letter word");
word = scan.nextLine()
}while(word.length() != 5);
System.out.println("Valid word entered!")
How would you draw this algorithm as a flowchart? Use any of the symbols above.
Simplify the input by just using input word
Simplify the output by just using output "Enter 5 letter word:"
pseudocodeWHILE ... DO ... END WHILE flowchartFOR... END FOR pre-condition loop IF... THEN... END IF count-controlled loop INPUT post-condition loopOUTPUT