Restore
This commit is contained in:
10
Labs/Lab6/Lab6_2230026071/Question1/.classpath
Normal file
10
Labs/Lab6/Lab6_2230026071/Question1/.classpath
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
Labs/Lab6/Lab6_2230026071/Question1/.project
Normal file
17
Labs/Lab6/Lab6_2230026071/Question1/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Question1</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>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
BIN
Labs/Lab6/Lab6_2230026071/Question1/bin/Shape.class
Normal file
BIN
Labs/Lab6/Lab6_2230026071/Question1/bin/Shape.class
Normal file
Binary file not shown.
BIN
Labs/Lab6/Lab6_2230026071/Question1/bin/Start.class
Normal file
BIN
Labs/Lab6/Lab6_2230026071/Question1/bin/Start.class
Normal file
Binary file not shown.
31
Labs/Lab6/Lab6_2230026071/Question1/src/Shape.java
Normal file
31
Labs/Lab6/Lab6_2230026071/Question1/src/Shape.java
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
public class Shape {
|
||||
//instance variables
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
//constructor
|
||||
public Shape(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
//methods
|
||||
public double getX() {return this.x;}
|
||||
|
||||
public double getY() {return this.y;}
|
||||
|
||||
public double area() {
|
||||
System.out.println("An unknown shape has an unknown area!");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
//test
|
||||
public static void testShape() {
|
||||
Shape s = new Shape(1.2, 3.4);
|
||||
System.out.println(s.getX() == 1.2);
|
||||
System.out.println(s.getY() == 3.4);
|
||||
System.out.println(s.area() == -1.0); // Will print an error message too.
|
||||
}
|
||||
|
||||
}
|
||||
9
Labs/Lab6/Lab6_2230026071/Question1/src/Start.java
Normal file
9
Labs/Lab6/Lab6_2230026071/Question1/src/Start.java
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
public class Start {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Shape.testShape();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user