-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b00cbe6
commit 35f8c04
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bin/* | ||
dist/* | ||
reports/* | ||
docs/* | ||
|
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
public class Rectangle{ | ||
public int length; | ||
public int width; | ||
|
||
public Rectangle ( int length, int width) { | ||
this.length = length; | ||
this.width = width; | ||
} | ||
public int getArea() { | ||
return length * width; | ||
|
||
} | ||
|
||
public int getPerimeter () { | ||
return 2 * ( length + width); | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
public class Rectangulator { | ||
public static void main (String[] args) { | ||
int length = Integer.parseInt(args[0]); | ||
int width = Integer.parseInt(args[1]); | ||
|
||
Rectangle myRectangle = new Rectangle(length, width); | ||
String output = String.format ("*** Your Rectangle ***\n\nLength: %d\nWidth: %d\nArea: %d\nPerimeter %d\n\n", myRectangle.length, myRectangle.width, myRectangle.getArea(), myRectangle.getPerimeter();) | ||
|
||
System.out.println(output); | ||
|
||
} | ||
|
||
} |