Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Michal Slanina
ZT-B
Commits
f1bd4767
Commit
f1bd4767
authored
4 years ago
by
“xslanina”
Browse files
Options
Download
Email Patches
Plain Diff
Cviceni 3
parent
cbdebb6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
155 additions
and
0 deletions
+155
-0
classes/ZdrojMichalSlanina.php
classes/ZdrojMichalSlanina.php
+137
-0
index.php
index.php
+18
-0
No files found.
classes/ZdrojMichalSlanina.php
0 → 100644
View file @
f1bd4767
<?php
namespace
SlaninaMichalZdroj
;
class
ZdrojMichalSlanina
{
public
function
__construct
(
int
$napeti
=
230
)
{
if
(
$napeti
<=
240
&&
$napeti
>=
220
)
{
$this
->
napeti
=
$napeti
;
$this
->
setMichalSlaninaNapeti110V
(
$napeti
);
$this
->
setMichalSlaninaNapeti48V
(
$napeti
);
$this
->
setMichalSlaninaNapeti12V
(
$napeti
);
$this
->
setMichalSlaninaNapeti9V
(
$napeti
);
$this
->
setMichalSlaninaNapeti4_5V
(
$napeti
);
$this
->
setMichalSlaninaNapeti1_5V
(
$napeti
);
}
else
return
0
;
}
// motody
/**
* setMichalSlaninaNapeti110V
*
* @param int $napeti
* @return 110V
*/
private
function
setMichalSlaninaNapeti110V
(
int
$napeti
)
{
$this
->
michalSlaninaNapeti110V
=
round
(
$napeti
/
round
(
230
/
110
,
2
),
2
);
}
/**
* setMichalSlaninaNapeti48V
*
* @param int $napeti
* @return 48V
*/
private
function
setMichalSlaninaNapeti48V
(
int
$napeti
)
{
$this
->
michalSlaninaNapeti48V
=
round
(
$napeti
/
round
(
230
/
48
,
2
),
2
);
}
/**
* setMichalSlaninaNapeti12V
*
* @param int $napeti
* @return 12V
*/
private
function
setMichalSlaninaNapeti12V
(
int
$napeti
)
{
$this
->
michalSlaninaNapeti12V
=
round
(
$napeti
/
round
(
230
/
12
,
2
),
2
);
}
/**
* setMichalSlaninaNapeti9V
*
* @param int $napeti
* @return 9V
*/
private
function
setMichalSlaninaNapeti9V
(
int
$napeti
)
{
$this
->
michalSlaninaNapeti9V
=
round
(
$napeti
/
round
(
230
/
9
,
2
),
2
);
}
/**
* setMichalSlaninaNapeti4_5V
*
* @param int $napeti
* @return 4.5V
*/
private
function
setMichalSlaninaNapeti4_5V
(
int
$napeti
)
{
$this
->
michalSlaninaNapeti4_5V
=
round
(
$napeti
/
round
(
230
/
4.5
,
2
),
2
);
}
/**
* setMichalSlaninaNapeti1_5V
*
* @param int $napeti
* @return 1.5V
*/
private
function
setMichalSlaninaNapeti1_5V
(
int
$napeti
)
{
$this
->
michalSlaninaNapeti1_5V
=
round
(
$napeti
/
round
(
230
/
1.5
,
2
),
2
);
}
// get metody vydavajici zaokrouhlene napeti
/**
* getMichalSlaninaNapeti110V
*
* @return 110V
*/
public
function
getMichalSlaninaNapeti110V
()
{
return
$this
->
michalSlaninaNapeti110V
;
}
/**
* getMichalSlaninaNapeti48V
*
* @return 48V
*/
public
function
getMichalSlaninaNapeti48V
()
{
return
$this
->
michalSlaninaNapeti48V
;
}
/**
* getMichalSlaninaNapeti12V
*
* @return 12V
*/
public
function
getMichalSlaninaNapeti12V
()
{
return
$this
->
michalSlaninaNapeti12V
;
}
/**
* getMichalSlaninaNapeti9V
*
* @return 9V
*/
public
function
getMichalSlaninaNapeti9V
()
{
return
$this
->
michalSlaninaNapeti9V
;
}
/**
* getMichalSlaninaNapeti4_5V
*
* @return 4.5V
*/
public
function
getMichalSlaninaNapeti4_5V
()
{
return
$this
->
michalSlaninaNapeti4_5V
;
}
/**
* getMichalSlaninaNapeti1_5V
*
* @return 1.5V
*/
public
function
getMichalSlaninaNapeti1_5V
()
{
return
$this
->
michalSlaninaNapeti1_5V
;
}
}
This diff is collapsed.
Click to expand it.
index.php
View file @
f1bd4767
<?php
require
'classes/UserMichalSlanina.php'
;
require
'classes/ZdrojMichalSlanina.php'
;
use
SlaninaMichalUser\michalSlaninaUtils
;
$zdroj
=
new
SlaninaMichalZdroj\ZdrojMichalSlanina
;
echo
"<p>Výpis variabilních symbolů</p>"
;
echo
"<br>"
;
// vypise 5 variabilnich symbolu zacinajicich 2020
...
...
@@ -16,4 +20,18 @@ echo michalSlaninaUtils::getVsMichalSlanina(3);
echo
"<br>"
;
echo
michalSlaninaUtils
::
getVsMichalSlanina
(
9
);
echo
"<br>"
;
echo
"<br>"
;
// Vypsani get metod napeti v indexu
echo
$zdroj
->
getMichalSlaninaNapeti110V
();
echo
"<br>"
;
echo
$zdroj
->
getMichalSlaninaNapeti48V
();
echo
"<br>"
;
echo
$zdroj
->
getMichalSlaninaNapeti12V
();
echo
"<br>"
;
echo
$zdroj
->
getMichalSlaninaNapeti9V
();
echo
"<br>"
;
echo
$zdroj
->
getMichalSlaninaNapeti4_5V
();
echo
"<br>"
;
echo
$zdroj
->
getMichalSlaninaNapeti1_5V
();
echo
"<br>"
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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