6.30 AP Line An APLine is a line defined by the equation ax +by+C =0, where a is not equal to zero, bis not equal to zer
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
6.30 AP Line An APLine is a line defined by the equation ax +by+C =0, where a is not equal to zero, bis not equal to zer
must include: 1- A constructor that has three integer parameters that represent a, b, and c, in that order. You may assume that the values of the parameters representing a and b are not zero. 2- A method getSlope that calculates and returns the slope of the line. 3- A method isOnLine that returns true if the point represented by its two parameters (x and y, in that order) is on the APLine and returns false otherwise. Example: Input -25-40 30 Output a = -25, b = -40, C = 30 Slope: -0.625 On line: false Input 54-17 Output a = 5, b = 4, C = -17 Slope: -1.25 On line: true
File is marked as read only Current file: Main.java 3 public class Main 4 { 5 public static void main(String[] args) 6 { 7 Scanner scnr = new Scanner(System.in); 8 int a = scnr.nextInt(); 9 int b = scnr.nextInt(); 10 int c = scnr.nextInt(); 11 12 System.out.println("a = "+a+", b = "+b+", C = "+c); //print the 13 APLine linel = new APLine(a, 14 System.out.println("Slope: + line1.getslope()); 16 System.out.println("On line: " + linei. isOnLine(5, -2)); 17 18 } 15
Current file: APLine.java 1 public class APLine 2{ 3 private int a,b,c; 4 5 public APLine(int a1, int bi, int ci) 6 { 7 // Your code here 8 } 9 10 public double getslope() { 12 // Your code here 13 } OVOU AWNA 11 HH2 NP 14 15 public boolean isOnLine(int x, int v)