Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kurs_java_alx_20240321
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
kurs_java_alx_20240321
Commits
192890b6
Commit
192890b6
authored
Apr 12, 2024
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wersja z ifami
parent
af3d469a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
Konto.java
src/p11_klasy/enkapsulacja/Konto.java
+6
-1
ProgramBankowy.java
src/p11_klasy/enkapsulacja/ProgramBankowy.java
+4
-1
No files found.
src/p11_klasy/enkapsulacja/Konto.java
View file @
192890b6
...
...
@@ -38,8 +38,13 @@ public class Konto {
this
.
wlasciciel
=
wlasciciel
;
}
public
void
wplata
(
int
kwota
)
{
public
boolean
wplata
(
int
kwota
)
{
if
(
kwota
>
0
)
{
this
.
saldo
+=
kwota
;
return
true
;
}
else
{
return
false
;
}
}
public
void
wyplata
(
int
kwota
)
{
...
...
src/p11_klasy/enkapsulacja/ProgramBankowy.java
View file @
192890b6
...
...
@@ -30,8 +30,11 @@ public class ProgramBankowy {
System
.
out
.
print
(
"Podaj kwotę wpłaty: "
);
kwota
=
sc
.
nextInt
();
sc
.
nextLine
();
konto
.
wplata
(
kwota
);
if
(
konto
.
wplata
(
kwota
))
{
System
.
out
.
println
(
"Pieniądze zostały wpłacone"
);
}
else
{
System
.
out
.
println
(
"Był problem z wpłatą"
);
}
}
case
"Y"
->
{
System
.
out
.
print
(
"Podaj kwotę wypłaty: "
);
...
...
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