Created
February 23, 2017 14:30
-
-
Save jmurth1234/260cbcf87935e20e306e62dc11ce9e15 to your computer and use it in GitHub Desktop.
my session created by rymate1234 - https://repl.it/FvL2/3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
public static void main(String[] args) { | |
System.out.println("hello world"); | |
Triangle lab = new Triangle("simple", 3, 4); | |
System.out.println(lab); | |
lab.printStyle(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Triangle extends TwoDShapeForLab { | |
private String style; | |
public Triangle(String style, double width, double length) { | |
super(width, length); | |
this.style = style; | |
} | |
public double area() | |
{ | |
return (getWidth() * getLength()) / 2; | |
} | |
public String getStyle() | |
{ | |
return style; | |
} | |
public void printStyle() | |
{ | |
System.out.println(getStyle()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class TwoDShapeForLab here. | |
* | |
* @author (your name) | |
* @version (a version number or a date) | |
*/ | |
public class TwoDShapeForLab | |
{ | |
private double width; | |
private double length; | |
/** | |
* Parameterized constructor for TwoDShapeForLab | |
* | |
* @param width the shape's width | |
* @param length the shape's length | |
*/ | |
public TwoDShapeForLab(double width, double length) | |
{ | |
this.width = width; | |
this.length = length; | |
} | |
/** | |
* Get the shape's width | |
* | |
* @return the width | |
*/ | |
public double getWidth() | |
{ | |
return width; | |
} | |
/** | |
* Get the shape's length | |
* | |
* @return the length | |
*/ | |
public double getLength() | |
{ | |
return length; | |
} | |
public String toString() | |
{ | |
return "Width and length are " + width + " and " + length; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment