Question: solve using c++ You must design 3 algorithms, and provide both a flow chart and pseudo code for the algorithms. Algorithm descriptions: Given an integer
solve using c++


You must 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: const int MIN_NUMBER = 1; const 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 function) on one side of the paper and the matching pseudo-code next to it or on the other side. Implement your algorithms with three functions for this phase. The functions should behave as described in phase 1. The forward function should wrap around when it reaches the last number the backward function should stop when it reaches the first number Add the MIN NUMBER and MAX NUMBER constants at the top of your class, you will also need to add a glabal variable at the top of your class: const int MIN_NUMBER - 1; const int MAX_NUMBER - 8; int image_number = 1; The forward and backward functions MUST use an input parameter and outout a return value, they DO NOT use the above global variable image_number directly, but they should use the constants. The functions are very simple when the current image number is 3 forward changes it to a 1 and returns it. When the current image number is o backward() changes it to a 5 and returns it. The function createFileName will take a number as input, and returns a string containing a file nare like 'pictureX.gif" The function createRandomNamel has no input, and turns a string containing a file name live pictureX sif. Implement the following functions int forward C int current number ) { // return the new image number int backward (int current_number ) { // return the new image number // use the constants MIN_NUMBER, MAX_NUMBER, do not use hard coded 1 or 8 string createFilme (int current_number ) [ // return a filename like picturex.gif string createRandomvame() { // return a filename like picturex.gif // using a RANDOM number between MIN_NI,MBER and MAX_NI,MBER void showeru () { // write a loop // Display a menu, with options 1. N for each function above, and an exit option // get user input and call the correct function using a SWITCH // print out the NEN image number everytime the value changes int main({ // call showMenu return; 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
