Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20230403
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Patryk Czarnik
20230403
Commits
96cecf1c
Commit
96cecf1c
authored
Apr 03, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Konto - synchroniacja metod
parent
7e1cb20d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Konto.java
PC21-Watki/src/konto/Konto.java
+3
-3
No files found.
PC21-Watki/src/konto/Konto.java
View file @
96cecf1c
...
@@ -32,20 +32,20 @@ public class Konto {
...
@@ -32,20 +32,20 @@ public class Konto {
return
"Konto nr "
+
numer
+
", wł. "
+
wlasciciel
+
", saldo "
+
saldo
;
return
"Konto nr "
+
numer
+
", wł. "
+
wlasciciel
+
", saldo "
+
saldo
;
}
}
public
void
wplata
(
int
kwota
)
{
public
synchronized
void
wplata
(
int
kwota
)
{
if
(
kwota
<=
0
)
{
if
(
kwota
<=
0
)
{
throw
new
IllegalArgumentException
(
"Niedodatnia kwota w metodzie wplata"
);
throw
new
IllegalArgumentException
(
"Niedodatnia kwota w metodzie wplata"
);
}
}
saldo
+=
kwota
;
saldo
+=
kwota
;
}
}
public
void
wyplata
(
int
kwota
)
throws
BrakSrodkow
{
public
synchronized
void
wyplata
(
int
kwota
)
throws
BrakSrodkow
{
if
(
kwota
<=
0
)
{
if
(
kwota
<=
0
)
{
throw
new
IllegalArgumentException
(
"Niedodatnia kwota w metodzie wyplata"
);
throw
new
IllegalArgumentException
(
"Niedodatnia kwota w metodzie wyplata"
);
}
}
if
(
kwota
>
saldo
)
{
if
(
kwota
>
saldo
)
{
throw
new
BrakSrodkow
(
"Brak środków na koncie nr "
+
numer
);
throw
new
BrakSrodkow
(
"Brak środków na koncie nr "
+
numer
);
}
}
this
.
saldo
-=
kwota
;
saldo
-=
kwota
;
}
}
}
}
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