Header

CIT ALUMNI 1988-92

Alumni of Coimbatore Institute of Technology
 

VegasMeet

 

Volunteer

Sign Up

 

College Days

College Days

Up Coming Events

August  2018
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Ilan menu

Ilan Slider

Kavitha and Min Attending Training

import java.util.*;

 

public class LineTester

 

{

 

public static void main (String[] args)

 

{

 

Scanner input = new Scanner ( System.in);

 

System.out.print("What is the slope of your line? ");

 

double m1 = input.nextDouble();

 

System.out.print("What is the y-intercept of your line? ");

 

double b1 = input.nextDouble();

 

LineFunctions line = new OneLine(m1,b1);

 

System.out.println("\nSlope of this line is: "+line.getSlope());

 

System.out.println("\nY-intercept of this line is: "+line.getYIntercept());

 

System.out.println("\nRoot of this line is: "+line.getRoot());

 

 

 

System.out.println("\nWhat is an x value for which you wish to solve for y? ");

 

double x1 = input.nextDouble();

 

double y1 = line.getYvalue(x1);

 

System.out.println(" the y value corresponding to x = "+x1+" is " + y1);

 

 

 

System.out.println("\nWhat is a y value for which you wish to solve for x? ");

 

double y2 = input.nextDouble();

 

double x2 = line.getXvalue(y2);

 

System.out.println(" the x value corresponding to y = "+y2+" is " + x2);

 

}

 

}