Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20240528-BJava
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
20240528-BJava
Commits
7f6863d8
Commit
7f6863d8
authored
Jun 13, 2024
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dalszde operacje pierwszego webserwisu
parent
791a626f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
PierwszaUsluga.java
PC25-SoapSerwer/src/main/java/hello/PierwszaUsluga.java
+14
-3
No files found.
PC25-SoapSerwer/src/main/java/hello/PierwszaUsluga.java
View file @
7f6863d8
...
...
@@ -2,6 +2,8 @@ package hello;
import
jakarta.jws.WebService
;
import
java.time.LocalTime
;
@WebService
public
class
PierwszaUsluga
{
public
String
hello
()
{
...
...
@@ -12,9 +14,18 @@ public class PierwszaUsluga {
return
"Witaj "
+
imie
;
}
// dodaj metody:
// ktoraGodzina - bez parametru, zwraca bieżący czas
public
String
ktoraGodzina
()
{
return
LocalTime
.
now
().
toString
();
}
// oblicz(liczba1, liczba2, operacja) - wykonuje perację arytmetyczną i zwraca wynik liczbowy
public
long
oblicz
(
long
liczba1
,
long
liczba2
,
String
operacja
)
{
return
switch
(
operacja
)
{
case
"+"
->
liczba1
+
liczba2
;
case
"-"
->
liczba1
-
liczba2
;
case
"*"
->
liczba1
*
liczba2
;
case
"/"
->
liczba1
/
liczba2
;
default
->
throw
new
IllegalArgumentException
(
"nieznana operacja "
+
operacja
);
};
}
}
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