Project 1: X-Intercept of a Line

All non-horizontal lines will have exactly one x-intercept.  The x-intercept is the x-coordinate for where the line crosses the x-axis.  For the line shown below: y = 3x -2, the x-intercept is 2/3 or around .6667. 

 

Algebraically, you can determine the x-intercept of a line by setting y equal to 0 (since that is the y-coordinate of the point when the line crosses the x-axis). 

 

0 = 3x – 2

2 = 3x

2/3 = x

Project 1: Variables 'm' and 'b' have been initialized.  This means they already have a value (but the value is unknown).

'm' represents the slope of the line (3 in the example above)

'b' represents the y-intercept of the line (-2 in the example above)

Task: correctly initialize a variable called 'zero' that represents the value of the x-intercept (zero) of the line.  

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0