// Marty Stepp, CSE 142, Autumn 2008 // This program demonstrates a slope function that returns a value. public class MathExamples { public static void main(String[] args) { double power = 3 + Math.pow(3, 4) * 5; System.out.println(power); double result = slope(1, 2, 7, 5); System.out.println("The slope is " + result); } // Returns the slope of the line between the given points. public static double slope(int x1, int y1, int x2, int y2) { double dy = y2 - y1; double dx = x2 - x1; double m = dy / dx; return m; } }