id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > dec18_2015_HL_findGolden
prev  |  next  |  chance

Write a method that recursively computes the nth approximation of the Golden Ratio using the recursive computational method shown here: As a pre-condition, the parameter n will be greater than or equal to zero and will not be so large as to cause a stack-overflow for a well-made program. For n=0 (the 0th approximation) simply use 1. For n>0 the approximation is equal to 1+(1/G(n-1)) where G(n-1) is the (n-1)th approximation of the Golden Ratio. Look at the test data for examples.


dec18_2015_HL_findGolden(29) → 1.6180339887505406
dec18_2015_HL_findGolden(7) → 1.619047619047619
dec18_2015_HL_findGolden(0) → 1.0

...Save, Compile, Run (ctrl-enter)

public double dec18_2015_HL_findGolden(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 230

Copyright Nick Parlante 2017 - privacy