Skip to content
Snippets Groups Projects
Commit 23a07f9e authored by Goik Martin's avatar Goik Martin
Browse files

No longer needed

parent bb7cb0c3
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 476 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/bin
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Figur</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
package step1;
/**
* A circle of given radius
*
*/
public class Circle {
double radius;
/**
* A new circle
* @param radius The desired radius.
*/
public Circle(double radius) {
setRadius(radius);
}
/**
* @return The circle's area.
*/
public double getArea() {
return radius * radius * Math.PI;
}
/**
* @return The circle's perimeter.
*/
public double getPerimeter() {
return 2 * Math.PI * radius;
}
/**
* @return The circle's radius.
*/
public double getRadius() {
return radius;
}
/**
* @param radius Setting the circle's radius to a new value.
*/
public void setRadius(double radius) {
this.radius = radius;
}
}
\ No newline at end of file
package step1;
public class DriverCircle {
public static void main(String[] args) {
final Circle c = new Circle(2.3);
System.out.println("Radius:" + c.getRadius());
System.out.println("Perimeter:" + c.getPerimeter());
System.out.println("Area:" + c.getArea());
// Changing the circle's radius to a different value
c.setRadius(4.7);
System.out.println("Radius:" + c.getRadius());
System.out.println("Perimeter:" + c.getPerimeter());
System.out.println("Area:" + c.getArea());
}
}
package step1;
public class DriverRectangle {
public static void main(String[] args) {
final Rectangle r = new Rectangle(8, 5);
System.out.println("Perimeter:" + r.getPerimeter());
System.out.println("Area:" + r.getArea());
r.setWidth(4);
r.setHeight(7);
System.out.println("Perimeter:" + r.getPerimeter());
System.out.println("Area:" + r.getArea());
}
}
package step1;
/**
* Representing rectangular shapes.
*
*/
public class Rectangle {
// Instance variables representing a rectangle's parameters
private double width, height;
/**
*
* @param width The rectangle's width
* @param heigth The rectangle's height
*/
public Rectangle (double width, double height) {
setWidth(width);
setHeight(height);
}
/**
* @return The rectangle's area.
*/
public double getArea() {
return width * height;
}
/**
* @return The rectangle's perimeter.
*/
public double getPerimeter() {
return 2 * (width + height);
}
/**
* @return The rectangle's width.
*/
public double getWidth() {
return width;
}
/**
* @param width The rectangle's new width
*/
public void setWidth(double w) {
width = w;
}
/**
* @return The rectangle's height.
*/
public double getHeight() {
return height;
}
/**
* @param width The rectangle's new height
*/
public void setHeight(double height) {
this.height = height;
}
}
\ No newline at end of file
package step1.dummy;
/**
* A circle of given radius
*
*/
public class Circle {
/**
* A new circle
*
* @param radius
* The desired radius.
*/
public Circle(double radius) {
// TODO
}
/**
* @return The circle's area.
*/
public double getArea() {
return 0; // TODO
}
/**
* @return The circle's perimeter.
*/
public double getPerimeter() {
return 0; // TODO
}
/**
* @return The circle's radius.
*/
public double getRadius() {
return 0; // TODO
}
/**
* @param radius
* Setting the circle's radius to a new value.
*/
public void setRadius(double radius) {
// TODO
}
}
package step1.dummy;
/**
* Representing rectangular shapes.
*
*/
public class Rectangle {
/**
*
* @param width The rectangle's width
* @param heigth The rectangle's height
*/
public Rectangle (double width, double heigth) {
//TODO
}
/**
* @return The rectangle's area.
*/
public double getArea() {
return 0; // TODO
}
/**
* @return The rectangle's perimeter.
*/
public double getPerimeter() {
return 0; // TODO
}
/**
* @return The rectangle's width.
*/
public double getWidth() {
return 0; // TODO
}
/**
* @param width The rectangle's new width
*/
public void setWidth(double width) {
// TODO
}
/**
* @return The rectangle's height.
*/
public double getHeight() {
return 0; // TODO
}
/**
* @param width The rectangle's new height
*/
public void setHeight(double height) {
// TODO
}
}
package step2;
/**
* A circle of given radius
*
*/
public class Circle {
double x, y, radius;
/**
* A new circle
* @param radius The desired radius.
*/
public Circle(int x, int y, double radius) {
setRadius(radius);
}
/**
* @return The circle's area.
*/
public double getArea() {
return radius * radius * Math.PI;
}
/**
* @return The circle's perimeter.
*/
public double getPerimeter() {
return 2 * Math.PI * radius;
}
/**
* @return The circle's radius.
*/
public double getRadius() {
return radius;
}
/**
* @param radius Setting the circle's radius to a new value.
*/
public void setRadius(double radius) {
this.radius = radius;
}
/**
* @param x The circle's x center coordinate value
*/
public void setX(double x) {
this.x = x;
}
/**
* @param x The circle's x center coordinate value
*/
public void setY(double y) {
this.y = y;
}
public void writeSvg() {
final int scale = 20;
System.out.println(
"<circle r='" + scale * radius +
"' cx='" + scale * x + "'" + " cy='" + scale * y +
"' style='fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)'/>");
}
}
\ No newline at end of file
package step2;
public class Driver {
public static void main(String[] args) {
System.out.println("<!DOCTYPE html><html><body>");
System.out.println(" <svg width='300' height='200' >");
// Draw a rectangle as SVG
final Rectangle r = new Rectangle(5, 4);
r.setX(2);
r.setY(1);
r.writeSvg();
// Draw a circle as SVG
final Circle c = new Circle(1, 1, 3);
c.setX(3);
c.setY(1);
c.writeSvg();
System.out.println(" </svg >");
System.out.println("</body></html>");
}
}
package step2;
/**
* Representing rectangular shapes.
*
*/
public class Rectangle {
// Instance variables representing a rectangle's parameters
private double x, y, width, height;
/**
*
* @param width The rectangle's width
* @param heigth The rectangle's height
*/
public Rectangle (double width, double height) {
setWidth(width);
setHeight(height);
}
/**
* @return The rectangle's area.
*/
public double getArea() {
return width * height;
}
/**
* @return The rectangle's perimeter.
*/
public double getPerimeter() {
return 2 * (width + height);
}
/**
* @return The rectangle's width.
*/
public double getWidth() {
return width;
}
/**
* @param width The rectangle's new width
*/
public void setWidth(double w) {
width = w;
}
/**
* @return The rectangle's height.
*/
public double getHeight() {
return height;
}
/**
* @param width The rectangle's new height
*/
public void setHeight(double height) {
this.height = height;
}
/**
* @param x The rectangle's x center coordinate value
*/
public void setX(double x) {
this.x = x;
}
/**
* @param x The rectangle's x center coordinate value
*/
public void setY(double y) {
this.y = y;
}
public void writeSvg() {
final int scale = 20;
System.out.println(
"<rect width='" + scale * width +"' height='" + scale * height +
"' x='" + scale * x + "'" + " y='" + scale * y + "'" +
"' style='fill:rgb(0,255,0);stroke-width:3;stroke:rgb(0,0,0)'/>");
}
}
package step3;
public class Vector {
private double x, y;
public Vector(double x, double y) {
this.x = x;
this.y = y;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment