CMPSCI111L
Project 3
Skip To Content
Dashboard
  • Login
  • Dashboard
  • Calendar
  • Inbox
  • History
  • Help
Close
  • My Dashboard
  • CMPSCI111L
  • Assignments
  • Project 3
2017FA
  • Home
  • Assignments
  • Syllabus
  • Quizzes
  • Collaborations
  • Library
  • The Learning Center
  • McGraw Hill Campus
  • Google Drive
  • Campus Resource Guide
  • EvaluationKIT Course
  • Online Tutoring
  • Services for Students
  • Employment Center
  • Office 365
  • Canyons Connects
  • Purchase Course Materials
  • Top Hat
  • Zoom
  • Lucid (Whiteboard)
  • Insights-Beta
  • Credentials
  • Insights

Project 3

  • Due Oct 6, 2017 by 11am
  • Points 30
  • Submitting on paper
  • Available Sep 30, 2017 at 12:30pm - Oct 6, 2017 at 12:30pm
This assignment was locked Oct 6, 2017 at 12:30pm.

Programming Project #3 – Methods (30 points)

Program1 - Phase 1

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:

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. Program1 - Phase 2 Implement your algorithms with three methods for this phase. The methods should behave as described in phase 1. The forward method should wrap around when it reaches the last number, the backward method 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: final static int MIN_NUMBER = 1; final static int MAX_NUMBER = 8; static int image_number = 1;

The forward() and backward() methods 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 methods 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 method createFileName() will take a number as input, and returns a String containing a file name like "pictureX.gif". The method createRandomName() has no input, and returns a String containing a file name like "pictureX.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 the constants MIN_NUMBER, MAX_NUMBER, do not use hard coded 1 or 8

public static String createFileName ( int current_number )

{ // return a filename like pictureX.gif }

public static String createRandomName ( )

{ // return a filename like pictureX.gif

// using a RANDOM number between MIN_NUMBER and MAX_NUMBER }

public static void showMenu ( ) {

// write a loop

// Display a menu, with options 1 .. N for each method above, and an exit option // get user input and call the correct method using a SWITCH

// print out the NEW image number everytime the value changes

}

public static void main ( String [] args)

{ // call showMenu }

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 methods and print onto the console the new image number everytime it changes.

Program2 -----------------------------------------------------------------------------

Write a test program that prompts the user to enter three numbers and invokes the method to display them in increasing order. Write a method with the following header to display three numbers in increasing order. public static void displaySortedNumbers(double num1, double num2, double num3)

1507312800 10/06/2017 11:00am
Please include a description
Additional Comments:
Rating max score to > pts
Please include a rating title

Rubric

Find Rubric
Please include a title
Find a Rubric
Title
You've already rated students with this rubric. Any major changes could affect their assessment results.
 
 
 
 
 
 
 
     
Can't change a rubric once you've started using it.  
Title
Criteria Ratings Pts
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit criterion description Delete criterion row
5 to >0 pts Full Marks blank
0 to >0 pts No Marks blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit criterion description Delete criterion row
5 to >0 pts Full Marks blank
0 to >0 pts No Marks blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
Total Points: 5 out of 5