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
7358486a
Commit
7358486a
authored
Dec 03, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
importowanie - przygotowania
parent
1073a755
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
Geometria.java
src/main/java/p08_funkcje/przyklady/Geometria.java
+4
-0
GeometriaProgram.java
src/main/java/p08_funkcje/przyklady/GeometriaProgram.java
+13
-13
No files found.
src/main/java/p08_funkcje/przyklady/Geometria.java
View file @
7358486a
package
p08_funkcje
.
przyklady
;
public
class
Geometria
{
// Aby nikomu nie przyszło do głowy tworzenie obiektu tej klasy,
// można ukryć konstruktor domyślny:
private
Geometria
()
{
}
public
static
double
poleKwadratu
(
double
a
)
{
return
a
*
a
;
...
...
src/main/java/p08_funkcje/przyklady/GeometriaProgram.java
View file @
7358486a
...
...
@@ -64,25 +64,25 @@ public class GeometriaProgram {
System
.
out
.
printf
(
"%.3f km = %.3f mil\n"
,
km
,
wynik
);
}
case
"MK"
->
{
System
.
out
.
print
(
"Podaj odległość w milach: "
);
double
mile
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
mile_na_km
(
mile
);
System
.
out
.
printf
(
"%.3f mil = %.3f km\n"
,
mile
,
wynik
);
System
.
out
.
print
(
"Podaj odległość w milach: "
);
double
mile
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
mile_na_km
(
mile
);
System
.
out
.
printf
(
"%.3f mil = %.3f km\n"
,
mile
,
wynik
);
}
case
"FC"
->
{
System
.
out
.
print
(
"Podaj temperaturę w Fahrenheitach: "
);
double
f
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
f_na_c
(
f
);
System
.
out
.
printf
(
"%.3f °F = %.3f °C\n"
,
f
,
wynik
);
System
.
out
.
print
(
"Podaj temperaturę w Fahrenheitach: "
);
double
f
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
f_na_c
(
f
);
System
.
out
.
printf
(
"%.3f °F = %.3f °C\n"
,
f
,
wynik
);
}
case
"CF"
->
{
System
.
out
.
print
(
"Podaj temperaturę w Celsjuszach: "
);
double
c
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
c_na_f
(
c
);
System
.
out
.
printf
(
"%.3f °C = %.3f °F\n"
,
c
,
wynik
);
System
.
out
.
print
(
"Podaj temperaturę w Celsjuszach: "
);
double
c
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
c_na_f
(
c
);
System
.
out
.
printf
(
"%.3f °C = %.3f °F\n"
,
c
,
wynik
);
}
default
->
{
System
.
out
.
println
(
"Nieznane polecenie "
+
wybor
);
System
.
out
.
println
(
"Nieznane polecenie "
+
wybor
);
}
}
}
...
...
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