diff --git a/HomeWork/index.html b/HomeWork/index.html index 56c2ca8..2d02bac 100644 --- a/HomeWork/index.html +++ b/HomeWork/index.html @@ -2,11 +2,22 @@ - - HomeWork4 + Button Functions - + + + + + - \ No newline at end of file + diff --git a/HomeWork/js/script.js b/HomeWork/js/script.js index e69de29..a5a00e5 100644 --- a/HomeWork/js/script.js +++ b/HomeWork/js/script.js @@ -0,0 +1,53 @@ +'use strict'; + +// First task + +// написати об*єкт студента який буде виводити ім*я, спеціальнісь, середній +// бал і кількість пропущених занять + +// Student Object +function Student(name, specialization, averageGrade, missedClasses) { + this.name = name; + this.specialization = specialization; + this.averageGrade = averageGrade; + this.missedClasses = missedClasses; +} + +// Method to display student information +Student.prototype.displayInfo = function () { + console.log(`Name: ${this.name}, Specialization: ${this.specialization}, Average Grade: ${this.averageGrade}, Missed Classes: ${this.missedClasses}`); +}; + +// Three instances of students +const student1 = new Student("John Doe", "Computer Science", 85, 2); +const student2 = new Student("Jane Smith", "Mathematics", 92, 1); +const student3 = new Student("Bob Johnson", "Physics", 78, 3); + +// Displaying information using the method +student1.displayInfo(); +student2.displayInfo(); +student3.displayInfo(); + + + +// Second task + +// Написати функцію магазин, яка отримує назву товару, ціну за кг і кількість товару +// функція має повертати назву товару і вартість +// перевірити на варіантах: +// 1) banana 30, 4,5 +// 2) cherry 58, 1,3 +// 3) jrange 89. 3,4 + +// Shop function +function shop(product, pricePerKg, quantity) { + const totalCost = pricePerKg * quantity; + return `Product: ${product}, Total Cost: ${totalCost}`; +} + +// Testing with different products +console.log(shop("banana", 30, 4.5)); +console.log(shop("cherry", 58, 1.3)); +console.log(shop("jrange", 89, 3.4)); + + diff --git a/Lesson/index.html b/Lesson/index.html index 67500f3..60fb53a 100644 --- a/Lesson/index.html +++ b/Lesson/index.html @@ -7,15 +7,15 @@ Lesson 5 -
-

Ann

-
-
+
+

Ann

+
+

Olga

-
-
+
+

Ivan

-
+
diff --git a/Lesson/js/script.js b/Lesson/js/script.js index f8cb82b..60e1b3e 100644 --- a/Lesson/js/script.js +++ b/Lesson/js/script.js @@ -1,4 +1,4 @@ -//замикання +замикання // function createUrl(domain) { // return function (url) { @@ -17,7 +17,8 @@ //_________________________// //_________________________// -//this + +this // function hello() { // console.log("hello", this); @@ -47,7 +48,7 @@ // this.style.background = "green"; // } -// // document.querySelector("div").onclick = changeColor; +// document.querySelector("div").onclick = changeColor; // let user = document.querySelectorAll("div"); @@ -70,7 +71,7 @@ // list.showList(); -//========= bind +========= bind // function hello() { // console.log(this); @@ -103,7 +104,7 @@ // const nataInfo = user.info.bind(Nata, "Odesa"); // nataInfo(); -//========= call +========= call // const userInfo = { // name: "name", @@ -124,7 +125,7 @@ // userInfo.logInfo.call(Vano, "developer"); -//apply +apply // const showUserInfo = { // name: name, @@ -139,12 +140,12 @@ // }, // }; -// const Vano = { +// const Vano1 = { // name: "Ivan", // age: 45, // }; -// showUserInfo.logInfo.apply(Vano, ["developer", "Lviv"]); +// showUserInfo.logInfo.apply(Vano1, ["developer", "Lviv"]); /////////////////////////////////// /////////////////////////////////// @@ -180,7 +181,7 @@ // const man = { // items: ["Костюм, рубашка"], // }; - + // const child = { // items: ["майка, шорти"], // };