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
1073a755
Commit
1073a755
authored
Dec 03, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uzupełnienie programu geometrycznego
parent
cd93913d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
6 deletions
+39
-6
GeometriaProgram.java
src/main/java/p08_funkcje/przyklady/GeometriaProgram.java
+39
-6
No files found.
src/main/java/p08_funkcje/przyklady/GeometriaProgram.java
View file @
1073a755
...
...
@@ -15,10 +15,10 @@ public class GeometriaProgram {
System
.
out
.
println
(
" O - koło"
);
System
.
out
.
println
(
" P - prostokąt"
);
System
.
out
.
println
(
" T - trójkąt"
);
//
System.out.println(" KM - przelicz kilometry na mile");
//
System.out.println(" MK - przelicz mile na kilometry");
//
System.out.println(" CF - przelicz °C na °F");
//
System.out.println(" FC - przelicz °F na °C");
System
.
out
.
println
(
" KM - przelicz kilometry na mile"
);
System
.
out
.
println
(
" MK - przelicz mile na kilometry"
);
System
.
out
.
println
(
" CF - przelicz °C na °F"
);
System
.
out
.
println
(
" FC - przelicz °F na °C"
);
System
.
out
.
println
(
" Q - zakończ"
);
String
wybor
=
scanner
.
next
().
toUpperCase
();
...
...
@@ -48,8 +48,41 @@ public class GeometriaProgram {
double
obwod
=
Geometria
.
obwodProstokata
(
a
,
b
);
System
.
out
.
printf
(
"Dla prostokąta o bokach %.3f i %.3f pole wynosi %.3f, a obwód %.3f\n"
,
a
,
b
,
pole
,
obwod
);
}
default
->
{
System
.
out
.
println
(
"Nieznane polecenie "
+
wybor
);
case
"T"
->
{
System
.
out
.
print
(
"Podaj trzy długości boków trójkąta: "
);
double
a
=
scanner
.
nextDouble
();
double
b
=
scanner
.
nextDouble
();
double
c
=
scanner
.
nextDouble
();
double
pole
=
Geometria
.
poleTrojkata
(
a
,
b
,
c
);
double
obwod
=
Geometria
.
obwodTrojkata
(
a
,
b
,
c
);
System
.
out
.
printf
(
"Dla prostokąta o bokach %.3f %.3f %.3f pole wynosi %.3f, a obwód %.3f\n"
,
a
,
b
,
c
,
pole
,
obwod
);
}
case
"KM"
->
{
System
.
out
.
print
(
"Podaj odległość w kilometrach: "
);
double
km
=
scanner
.
nextDouble
();
double
wynik
=
JednostkiMiary
.
km_na_mile
(
km
);
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
);
}
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
);
}
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
);
}
default
->
{
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