Description of this paper

Answers

Description

solution


Question

Question #3 ? Refactoring Programs;Refactor the following code, i.e. improve its quality without modifying its behavior;Use meaningful names for variables, parameters & functions;Provide proper documentation as required in the PAs;Provide proper indentation & programming style similar to the examples from the textbook, videos & PAs;Remove useless code;Simplify program;Improve performance;You will provide your version in the ?Your Modified Version? subsection which is already pre-filled with the original. Then, for each improvement you applied, use the table in the ?Summary? subsection to explain what you did & why you did it.;Program to Refactor;int mystery(int v1, int v2);if((v1 < 1) || (v2 < 1)) return 0;if(v1 < v2) return mystery(v1, v2-1)+1;if(v2 < v1) return mystery(v1-1, v2)+1;return mystery(v1-1, v2-1);Your Improved Version;int mystery(int v1, int v2);if((v1 < 1) || (v2 < 1)) return 0;if(v1 < v2) return mystery(v1, v2-1)+1;if(v2 < v1) return mystery(v1-1, v2)+1;return mystery(v1-1, v2-1);Summary of Improvements;Feel free to add rows to, or remove rows from, this table as needed

 

Paper#64469 | Written in 18-Jul-2015

Price : $22
SiteLock