Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
assassment 2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
suleman.hussain
assassment 2
Commits
0696bbb0
Commit
0696bbb0
authored
May 17, 2022
by
Suleman Hussain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u
parent
dc761705
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
11 deletions
+6
-11
Rectangle.java
src/Rectangle.java
+0
-5
unitTest.java
src/unitTest.java
+6
-6
No files found.
src/Rectangle.java
View file @
0696bbb0
...
@@ -31,11 +31,6 @@ public class Rectangle extends Shape{
...
@@ -31,11 +31,6 @@ public class Rectangle extends Shape{
this
.
setHeight
(
j
);
this
.
setHeight
(
j
);
this
.
setWidth
(
i
);
this
.
setWidth
(
i
);
}
}
public
Rectangle
(
int
i
)
{
super
();
this
.
setWidth
(
i
);
}
@Override
@Override
public
void
draw
()
{
public
void
draw
()
{
...
...
src/unitTest.java
View file @
0696bbb0
...
@@ -83,7 +83,7 @@ public class unitTest {
...
@@ -83,7 +83,7 @@ public class unitTest {
@Test
@Test
public
void
testRectangleConstructor
()
{
public
void
testRectangleConstructor
()
{
// test default constructor
// test default constructor
Shap
e
testShape
=
new
Rectangle
();
Rectangl
e
testShape
=
new
Rectangle
();
assertEquals
(
3
,
testShape
.
getWidth
());
assertEquals
(
3
,
testShape
.
getWidth
());
assertEquals
(
4
,
testShape
.
getHeight
());
assertEquals
(
4
,
testShape
.
getHeight
());
...
@@ -96,7 +96,7 @@ public class unitTest {
...
@@ -96,7 +96,7 @@ public class unitTest {
@Test
@Test
public
void
testRectangleWidth
()
{
public
void
testRectangleWidth
()
{
// test setSize()
// test setSize()
Shap
e
testShape
=
new
Rectangle
(
5
,
4
);
Rectangl
e
testShape
=
new
Rectangle
(
5
,
4
);
testShape
.
setWidth
(
6
);
testShape
.
setWidth
(
6
);
assertEquals
(
6
,
testShape
.
getWidth
());
assertEquals
(
6
,
testShape
.
getWidth
());
}
}
...
@@ -104,7 +104,7 @@ public class unitTest {
...
@@ -104,7 +104,7 @@ public class unitTest {
@Test
@Test
public
void
testRectangleHeight
()
{
public
void
testRectangleHeight
()
{
// test setSize()
// test setSize()
Shape
testShape
=
new
Rectangle
(
7
8
);
Rectangle
testShape
=
new
Rectangle
(
7
,
8
);
testShape
.
setHeight
(
3
);
testShape
.
setHeight
(
3
);
assertEquals
(
3
,
testShape
.
getHeight
());
assertEquals
(
3
,
testShape
.
getHeight
());
}
}
...
@@ -112,14 +112,14 @@ public class unitTest {
...
@@ -112,14 +112,14 @@ public class unitTest {
@Test
@Test
public
void
testRectangleCircumference
()
{
public
void
testRectangleCircumference
()
{
// test circumference()
// test circumference()
Shap
e
testShape
=
new
Rectangle
(
6
,
3
);
Rectangl
e
testShape
=
new
Rectangle
(
6
,
3
);
assertEquals
(
18.0
,
testShape
.
circumference
(),
1
e
-
6
);
assertEquals
(
18.0
,
testShape
.
circumference
(),
1
e
-
6
);
}
}
@Test
@Test
public
void
testRectangleArea
()
{
public
void
testRectangleArea
()
{
// test area()
// test area()
Shap
e
testShape
=
new
Rectangle
(
5
,
7
);
Rectangl
e
testShape
=
new
Rectangle
(
5
,
7
);
assertEquals
(
35.0
,
testShape
.
area
(),
1
e
-
6
);
assertEquals
(
35.0
,
testShape
.
area
(),
1
e
-
6
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment