CS 165 Final: CS 165 CSU PracticeFinalSolution

49 views14 pages
15 Feb 2019
School
Course
Professor

Document Summary

I, the undersigned, do hereby affirm that the work contained in this exam is solely my own, and that none of the results were achieved by cheating. This includes using automated tools to generate answers, stealing the answers off the web, etc. System. out. println("converges to " + series(2, 3)); public static void main(string[] args) { public static float series(long numer, long denom) { Consider the following program that computes a geometric series using a recursive method: public class finalexamrecursion : describe the geometric series computed by the code above: // compute term float result = (float)numer / (float)denom; if (numer < 0 || denom < 0) else return result; // recursive computation result += series(numer * 2, denom * 3); Yes, the program terminates when the long overflows, on the 39th recursive call. Show what the program shown below would print. public class arraylistprogram { public static void main(string[] args) {