Skip to content
Open

DZ #2

Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 7-converter/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function summ (amount, sourceCurrency, targetCurrency) {
switch (sourceCurrency) {
case 'RUB': switch (targetCurrency) {
case 'USD': return amount / 89.7619;
case 'EUR': return amount / 97.9126;
case 'GBP': return amount / 113.6027;
default: return null;
}
case 'USD': switch (targetCurrency) {
case 'RUB': return amount * 89.7619;
case 'EUR': return amount * 0.9168;
case 'GBP': return amount * 0.7901;
default: return null;
}
case 'EUR': switch (targetCurrency) {
case 'RUB': return amount * 97.9126;
case 'USD': return amount * 1.0908;
case 'GBP': return amount * 0.8619;
default: return null;
}
case 'GBP': switch (targetCurrency) {
case 'RUB': return amount * 113.6027;
case 'USD': return amount * 1.2656;
case 'EUR': return amount * 1.1602;
default: return null;
}
default:
return null;
}
};

console.log(summ(1000, 'RUB', 'USD'));
12 changes: 12 additions & 0 deletions 7-converter/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./app.js"></script>
</head>
<body>

</body>
</html>
22 changes: 22 additions & 0 deletions 8-crypto/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function crypto(password) {
let cryptoPass = password.split(['']);
cryptoPass.reverse();
return cryptoPass;
};
console.log(crypto('password'));


function check() {
let encryptedPass = crypto('password');
encryptedPass.reverse();
let truePass = encryptedPass.join('');

switch (truePass) {
case 'password':
console.log('Пароль верный!');
break;
default:
console.log('Пароль неверный!');
};
};
console.log(check());
12 changes: 12 additions & 0 deletions 8-crypto/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./app.js"></script>
</head>
<body>

</body>
</html>
15 changes: 15 additions & 0 deletions 9-sort-loops/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const arr = [1, 40, -50, -20, -10, 5, 0, 100];

function arrSort() {
for (let j = arr.length - 1; j > 0; j--) {
for (let i = 0; i < j; i++) {
if (arr[i] > arr[i + 1]) {
let temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
};
};
};
return arr;
}
console.log(arrSort(arr));
12 changes: 12 additions & 0 deletions 9-sort-loops/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./app.js"></script>
</head>
<body>

</body>
</html>