Question
How do I design 3 algorithms , and provide both a flow chart and pseudo code for the algorithms. Algorithm descriptions: Given an integer parameter
How do I design 3 algorithms, and provide both a flow chart and pseudo code for the algorithms.
Algorithm descriptions:
Given an integer parameter named current_number and two constant global variables: final static int MIN_NUMBER = 1; final static int MAX_NUMBER = 8;
Create an algorithm named forward, that will advance ONE value through a sequence of numbers 1, 2, 3 ... MAX_NUMBER. In other words, when passed a value of 3 in the parameter current_number, it simply returns a 4.
However, when MAX_NUMBER is reached the algorithm should wrap around back and return MIN_NUMBER. The algorithm will NEVER return a value larger than MAX_NUMBER.
Create an algorithm named backward, that will move through a sequence of numbers ... 3, 2, MIN_NUMBER. In other words, when passed a value of 6 in the parameter current_number, it simply returns a 5.
When MIN_NUMBER is reached the algorithm should STOP and return the value MIN_NUMBER. This algorithm will NEVER wrap around.
Create an algorithm named createFileName, that takes a number as input, current_number, and builds and returns a String like "pictureX.gif", where X is the value in the input parameter.
This should fit on 1 sheet of paper. Place the 3 flowcharts (one per method) on one side of the paper and the matching pseudo code next to it or on the other side.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started