Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
genie-log-kata-rpg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas BREIL
genie-log-kata-rpg
Commits
0b3a479c
Commit
0b3a479c
authored
4 months ago
by
Thomas BREIL
Browse files
Options
Downloads
Patches
Plain Diff
Change Add and Retrieve money method
parent
98d6d1d4
Branches
main
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/re/forestier/edu/rpg/player.java
+4
-6
4 additions, 6 deletions
src/main/java/re/forestier/edu/rpg/player.java
with
4 additions
and
6 deletions
src/main/java/re/forestier/edu/rpg/player.java
+
4
−
6
View file @
0b3a479c
...
...
@@ -42,16 +42,14 @@ public abstract class player {
public
void
removeMoney
(
i
nt
amount
)
throws
IllegalArgumentException
{
public
void
removeMoney
(
I
nt
eger
amount
)
throws
IllegalArgumentException
{
if
(
money
-
amount
<
0
)
{
throw
new
IllegalArgumentException
(
"Player can't have a negative money!"
);
}
money
=
Integer
.
parseInt
(
money
.
toString
())
-
amount
;
money
-=
amount
;
}
public
void
addMoney
(
int
amount
)
{
var
value
=
Integer
.
valueOf
(
amount
);
money
=
money
+
(
value
!=
null
?
value
:
0
);
public
void
addMoney
(
Integer
amount
)
{
money
=
money
+
(
amount
!=
null
?
amount
:
0
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment