Platinum Partner

Find X, Y Intercepts Of A Line

//Finds X, Y intercepts of a line

public class findIntercepts {
	//Finds X and Y intercepts for a line
	public static void main (String args[]){
		//input: Ax + By = C
		double A =5;
		double B =5;
		double C =5;
		System.out.println("X intercept: ("+findXIntercept(A,C)+ ",0)");
		System.out.println("Y intercept: (0,"+findYIntercept(B,C)+")");
	}
	public static Object findXIntercept(double A, double C){
		if (A==0){
			return null;
		}
		else {
			return C/A;
		}
	}
	public static Object findYIntercept(double B, double C){
		if (B==0){
			return null;
		}
		else{
			return C/B;
		}
	}
}
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}