Question
You need to design 3 algorithms and provide both a flowchart and pseudocode for the algorithm. algorithms Algorithm descriptions: Given an integer parameter called current_number
You need to design 3 algorithms and provide both a flowchart and pseudocode for the algorithm. algorithms Algorithm descriptions: Given an integer parameter called current_number and two constant global values variables: final static int MIN_NUMBER = 1; final static int MAX_NUMBER = 8; and develop an algorithm called forward, which will advance ONE value through a sequence of numbers 1, 2, 3 ... MAX_NUMBER. In other words, when passing a value of 3 in the current_number parameter, it simply returns a 4. However, when MAX_NUMBER is reached, the algorithm should return and return MIN_NUMBER. The algorithm will NEVER return a value greater than MAX_NUMBER. e an algorithm called backwards, which will move through a sequence of numbers ... 3, 2, MIN_NUMBER. In other words, when a value of 6 is passed into the current_number parameter, it simply returns a 5. When MIN_NUMBER is reached, the algorithm should STOP and return the value MIN_NUMBER. This algorithm will NEVER finish. and an algorithm called createFileName, which takes a number like input, current_number, and generates and returns a string like "pictureX.gif", where X is the value in the input parameter. This should fit on 1 sheet of paper. Put the 3 flow charts (one per method) into one side of the paper and the corresponding pseudocode on the side or on the other side. Program 1 - Phase 2 Implement your algorithms with three methods for this phase. Methods should behave as described in phase 1. The forwarding method should be adjusted when reaches the last number, the backspace method should stop when it reaches the first number. Add the MIN_NUMBER and MAX_NUMBER constants at the top of your class, you you'll also need to add a global variable at the top of your class: final static int MIN_NUMBER = 1; final static int MAX_NUMBER = 8; static int image_number = 1; The forward() and back() methods MUST use an input parameter and output a return value, do NOT directly use the global variable image_number above, but must use constants. The methods are very simple, when the current image the number is 3 forward changes it to 4 and returns it. When the current image number is 6 back() changes it to 5 and returns it. The createFileName() method takes a number as input and returns a string containing a file name such as "imageX.gif". The createRandomName() method has no input and returns a string containing a file name as "imageX.gif". Implement the following methods public static int forward (int current_number) { // return the new image number } public static int backward ( int current_number ) { // return the new image number } // use MIN_NUMBER, MAX_NUMBER constants, don't use hard coding 1 or 8 public static String createFileName (int current_number) { // return a file name like pictureX.gif } public static String createRandomName ( ) { // return a file name like pictureX.gif // using a RANDOM number between MIN_NUMBER and MAX_NUMBER } public static void showMenu() { // write a loop // Show a menu, with options 1 .. N for each method above, and an output option // get user input and call the correct method using a SWITCH // print the NEW image number each time the value changes } public static void main(String[] args) { // call displayMenu } The menu should have options to call forward(), back(), createFileName() and createRandomName() . Make sure to use a parameter when calling functions, then use the return value to update the global image number. At this point, your The program will display the menu, call the methods, and print the new menu to the console. image number each time it changes. a test program that prompts the user to enter three numbers and invokes the to display them in increasing order. a method with the following header to display three numbers in increasing order organize. Public Static Empty Display Ranked Numbers (number 1 double, number 2 double, number 3 double)
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