Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf9a05a

Browse files
committed
Added ability to swim
* Added Foot::flap() to advance the location of the penguin by 2* Updated comment
1 parent6a92fa2 commitbf9a05a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎src/animals/Penguin.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ public Penguin( int age,
4141

4242
publicvoidwaddle()
4343
{
44-
System.out.println("Creating a penguin" );
44+
System.out.println("Waddling" );
4545
leftFoot.moveForward();
4646
rightFoot.moveForward();
4747
}
48+
49+
publicvoidswim()
50+
{
51+
System.out.println("Swimming" );
52+
rightFoot.flap();
53+
leftFoot.flap();
54+
}
4855
}

‎src/animals/parts/Foot.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ public void moveForward()
2121
{
2222
location++;
2323
}
24+
25+
publicvoidflap()
26+
{
27+
location +=2;
28+
}
2429
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp