Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by hgates ( 6 years ago )
/**
 * This class finds the slope of the points that you input. 
 *
 * @hgates
 * @date : 10/9/20
 */
 
import java.util.Scanner;
 
public class MathChallenge 
{
    public static void main(String [] args)
    {
        Scanner in = new Scanner(System.in);
        
        System.out.println("Please enter values for of x1, x2, y1 and y2: ");
        
        System.out.println("Please pick a value for x1: ");
        double x1 = in.nextDouble();
        
        System.out.println("Please pick a number for y1: ");
        double y1 = in.nextDouble();
        
        System.out.println("Please pick a number for x2: ");
        double x2 = in.nextDouble();
        
        System.out.println("Please pick a number for y2: ");
        double y2 = in.nextDouble(); 
        
        System.out.println("The slope is... ");
        
        double m = (y2-y1)/(x2-x1);
        
        System.out.println(+m);
        
        System.out.println("The y-intercept of your equation is... ");
        double b = y1 - m * x1;
        
        System.out.println(+b);
        
        System.out.println( "y = " + m + " * x + " + b); 
        
        
        
 
    }
}

 

Revise this Paste

Your Name: Code Language: