Refactor Class + Variable Names

master
sgoudham 4 years ago
parent 3bf3458c82
commit e043348ffd
No known key found for this signature in database
GPG Key ID: EF51A29A50FB754C

@ -1,8 +1,8 @@
public class Coords { public class Coordinates {
private int x; private int x;
private int y; private int y;
public Coords(int x, int y) { public Coordinates(int x, int y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }

@ -7,7 +7,7 @@ public class Line {
private int y1; private int y1;
private int y2; private int y2;
public Line(Coords coords1, Coords coords2) { public Line(Coordinates coords1, Coordinates coords2) {
this.x1 = coords1.getX(); this.x1 = coords1.getX();
this.y1 = coords1.getY(); this.y1 = coords1.getY();
this.x2 = coords2.getX(); this.x2 = coords2.getX();

@ -1,12 +1,12 @@
public class Main { public class Main {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Coords p1 = new Coords(4, 16); Coordinates coordinate1 = new Coordinates(4, 16);
Coords p2 = new Coords(2, 8); Coordinates coordinate2 = new Coordinates(2, 8);
Line myLine = new Line(p1, p2); Line line = new Line(coordinate1, coordinate2);
myLine.calculateGradient(); line.calculateGradient();
myLine.calculateIntercept(); line.calculateIntercept();
myLine.displayEquation(); line.displayEquation();
} }
} }

Loading…
Cancel
Save