Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

CMPSCI 235 Algorithm Project Worksheet

CMPSCI 235 Algorithm Project Worksheet

CMPSCI 235 Algorithm Project Worksheet

Description

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.

Phase 2


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 global 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 output 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 4 and returns it. When the current image number is 6 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 name like “pictureX.gif”. The function createRandomName() has no input, and returns a string containing a file name like “pictureX.gif”.

Implement the following functions

int  forward ( 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  createFileName ( int current_number ) {
    // return a filename like pictureX.gif
}

string  createRandomName (  ) {
    // return a filename like pictureX.gif
	// using a RANDOM number between MIN_NUMBER and MAX_NUMBER 
}

void  showMenu (  ) {
    // 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 NEW image number everytime the value changes
}

int main () {
  //  call showMenu
  return 0;
}

The menu should have options for calling forward(), backward(), createFileName () and createRandomName ( ). Be sure to use a parameter when calling the functions, then use the return value to update the global image number. At this point, your program will show the menu, call the functions and print onto the console the new image number every time it changes.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20