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

 

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

Write a method that accepts an array of coordinates called 'coords'. Each pair of elements in the array represent a point, so (coords[0],coords[1]) is a point. In fact, that point represents the center of a circle. (coords[2],coords[3]) is a point on that circle. (coords[4],coords[5]) is another point on the same circle. You may assume that both points are the same distance from the center of the circle (within a small tolerance). Note that the radius is calculated based on the distance from the center of the circle to the starting point on the circle, NOT to the ending point on the circle (there could be a slight difference between the two since we are allowing a tolerance). You must return a string that tells the radius of the circle, and the starting and ending angle of the circle, as shown in the test data. NOTE: All this talk about a "tolerance" does NOT mean you don't have to match the test data. You need to figure out how to match the results of the test data in a "natural" way (not fixing it by hard-coding).


test2021_12_15_BONUS_arc([0, 0, 0.70710678119, 0.70710678119, -0.70710678119, -0.70710678119]) → "Radius=1.0000000000048825 : Start Angle=0.7853981633974483 : End Angle=3.9269908169872414"
test2021_12_15_BONUS_arc([0, 0, 0.5, 0.866, -0.866, 0.5]) → "Radius=0.9999779997579946 : Start Angle=1.0471848490249271 : End Angle=2.617981175819824"
test2021_12_15_BONUS_arc([15, 15, 15, 16, 14, 15]) → "Radius=1.0 : Start Angle=1.5707963267948966 : End Angle=3.141592653589793"

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

public String test2021_12_15_BONUS_arc(double[] coords) { }

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: 290

Copyright Nick Parlante 2017 - privacy