Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20231104-KursPodstawowyALX
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
20231104-KursPodstawowyALX
Commits
15314f6f
Commit
15314f6f
authored
Nov 18, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
szewc - wersje z ifem i switchem
parent
ebf04b5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
Szewc3.java
src/main/java/domowe/r1/szewc/Szewc3.java
+36
-0
Szewc4.java
src/main/java/domowe/r1/szewc/Szewc4.java
+35
-0
No files found.
src/main/java/domowe/r1/szewc/Szewc3.java
0 → 100644
View file @
15314f6f
package
domowe
.
r1
.
szewc
;
import
javax.swing.JOptionPane
;
public
class
Szewc3
{
public
static
void
main
(
String
[]
args
)
{
int
poczatek
=
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
"Którego dnia oddajesz buty do naprawy? [1-7]"
));
int
czasNaprawy
=
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
"Ile dni potrwa naprawa?"
));
int
koniec
=
(
poczatek
+
czasNaprawy
-
1
)
%
7
+
1
;
// wynikiem jest liczba od 1 do 7
JOptionPane
.
showMessageDialog
(
null
,
"Buty będą do odbioru w dzień nr "
+
koniec
);
if
(
koniec
==
1
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest poniedziałek"
);
}
if
(
koniec
==
2
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest wtorek"
);
}
if
(
koniec
==
3
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest środa"
);
}
if
(
koniec
==
4
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest czwartek"
);
}
if
(
koniec
==
5
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest piątek"
);
}
if
(
koniec
==
6
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest sobota"
);
}
if
(
koniec
==
7
)
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest niedziela"
);
}
}
}
src/main/java/domowe/r1/szewc/Szewc4.java
0 → 100644
View file @
15314f6f
package
domowe
.
r1
.
szewc
;
import
javax.swing.JOptionPane
;
public
class
Szewc4
{
public
static
void
main
(
String
[]
args
)
{
int
poczatek
=
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
"Którego dnia oddajesz buty do naprawy? [1-7]"
));
int
czasNaprawy
=
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
"Ile dni potrwa naprawa?"
));
int
koniec
=
(
poczatek
+
czasNaprawy
-
1
)
%
7
+
1
;
// wynikiem jest liczba od 1 do 7
JOptionPane
.
showMessageDialog
(
null
,
"Buty będą do odbioru w dzień nr "
+
koniec
);
switch
(
koniec
)
{
case
1
->
JOptionPane
.
showMessageDialog
(
null
,
"To jest poniedziałek"
);
case
2
->
JOptionPane
.
showMessageDialog
(
null
,
"To jest wtorek"
);
case
3
->
JOptionPane
.
showMessageDialog
(
null
,
"To jest środa"
);
case
4
->
JOptionPane
.
showMessageDialog
(
null
,
"To jest czwartek"
);
case
5
->
{
JOptionPane
.
showMessageDialog
(
null
,
"To jest piątek"
);
JOptionPane
.
showMessageDialog
(
null
,
"Weekendu początek"
);
}
case
6
->
JOptionPane
.
showMessageDialog
(
null
,
"To jest sobota"
);
case
7
->
JOptionPane
.
showMessageDialog
(
null
,
"To jest niedziela"
);
default
->
JOptionPane
.
showMessageDialog
(
null
,
"Niepoorawny numer "
+
koniec
,
"Błąd"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
}
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