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

 

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

Write a method that has four double input parameters, m1, b1, m2, and b2; where m1 is the slope and b1 is the y-value of the y-intercept for line 1 and m2 is the slope and b2 is the y-value of the y-intercept for line 2. So the input parameters represent the slopes and y-intercepts of two lines. Your goal is to find the intersection of those two lines and return it in a string as a coordinate pair. However, there are other possibilities besides having the two lines intersect in exactly one point. The two lines could also be parallel lines, in which case there are no solutions. If the two lines ARE parallel, return "parallel lines - no solutions". It is also possible that the two lines are the same. If the two lines ARE the same, return "coincident lines" (which means they are really the same line). Look at the test data for examples!


oct12_2018_HL_solveSystem(5.8, 100, 5.8, 91248) → "parallel lines - no solutions"
oct12_2018_HL_solveSystem(1, 4, -1, -2) → "(-3.0,1.0)"
oct12_2018_HL_solveSystem(5.5, 2.7, 1.3, 2.7) → "(0.0,2.7)"

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

public String oct12_2018_HL_solveSystem(double m1, double b1, double m2, double b2) { }

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