Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Class Exercise 1
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
luke.scott
Class Exercise 1
Commits
e44790b7
Commit
e44790b7
authored
May 16, 2022
by
luke.scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit
parents
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
Rectangle.java
src/Rectangle.java
+0
-0
Triangle.class
src/Triangle.class
+44
-0
No files found.
src/Rectangle.java
0 → 100644
View file @
e44790b7
src/Triangle.class
0 → 100644
View file @
e44790b7
public class Rectangle extends Shape{
int width;
int height;
public Rectangle() {
width = 3;
height = 4;
}
public Rectangle(int width, int height) {
this.width = width;
this.height = height;
}
public int getWidth(){return width;}
public int getHeight(){return height;}
public void setWidth(int width){this.width = width;}
public void setHeight(int height){this.height = height;}
public int getSize(){return size;}
public void setSize(int size) { this.size = size; }
@Override
public void draw() {
for (int loop1=0; loop1<size; loop1++){
for(int loop2=loop1; loop2<size; loop2++){
System.out.print("*");
}
System.out.println("");
}
}
@Override
public float area() {
float area = getWidth() * getHeight();
return area;
}
@Override
public float circumference() {
float circ = getWidth() * 2 + getHeight() * 2;
return circ;
}
public static void main(String[] args){
Shape aRectangle = new Rectangle(4);
}
}
\ 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