From 8ae500fbb3e4105423d4a03fd15fc67496feabe3 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Fri, 11 Oct 2024 19:55:52 +0300 Subject: [PATCH 01/15] =?UTF-8?q?=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0=204=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/code/func.go | 7 +++++++ golang/main.go | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 golang/code/func.go diff --git a/golang/code/func.go b/golang/code/func.go new file mode 100644 index 00000000..736494c7 --- /dev/null +++ b/golang/code/func.go @@ -0,0 +1,7 @@ +package func_ + +import "math" + +func Lab_4 (a, x float64) float64 { + return math.Pow(math.Log(a+x),2)/math.Pow(a+x, 2) +} \ No newline at end of file diff --git a/golang/main.go b/golang/main.go index d2c4e91e..7fe2b222 100644 --- a/golang/main.go +++ b/golang/main.go @@ -2,6 +2,12 @@ package main import "fmt" +import "isuct.ru/informatics2022/code" + func main() { - fmt.Println("Hello world") + var a float64 =2.0 + var xs = [8] float64 {1.2, 4.2, 0.6, 1.16, 1.32, 1.47, 1.65, 1.93} + for _, x:= range xs { + fmt.Println("y=", func_.Lab_4(a, x)) + } } From ca0e3a14668af21209e4e4265dc05497c8057db5 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Fri, 11 Oct 2024 20:06:54 +0300 Subject: [PATCH 02/15] =?UTF-8?q?=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0=204=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/main.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/golang/main.go b/golang/main.go index 7fe2b222..66d3de3d 100644 --- a/golang/main.go +++ b/golang/main.go @@ -1,13 +1,15 @@ package main -import "fmt" +import ( + "fmt" -import "isuct.ru/informatics2022/code" + func_ "isuct.ru/informatics2022/code" +) func main() { - var a float64 =2.0 - var xs = [8] float64 {1.2, 4.2, 0.6, 1.16, 1.32, 1.47, 1.65, 1.93} - for _, x:= range xs { - fmt.Println("y=", func_.Lab_4(a, x)) + var a float64 = 2.0 + var xs = [8]float64{1.2, 4.2, 0.6, 1.16, 1.32, 1.47, 1.65, 1.93} + for _, x := range xs { + fmt.Println("y =", func_.Lab_4(a, x)) } } From 7a2f88ced9afde40ab3ad9a17303b8a22bdc69a8 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Fri, 11 Oct 2024 20:25:46 +0300 Subject: [PATCH 03/15] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0=203=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D1=83=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/code/func.go | 7 ------- golang/main.go | 12 ++---------- 2 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 golang/code/func.go diff --git a/golang/code/func.go b/golang/code/func.go deleted file mode 100644 index 736494c7..00000000 --- a/golang/code/func.go +++ /dev/null @@ -1,7 +0,0 @@ -package func_ - -import "math" - -func Lab_4 (a, x float64) float64 { - return math.Pow(math.Log(a+x),2)/math.Pow(a+x, 2) -} \ No newline at end of file diff --git a/golang/main.go b/golang/main.go index 66d3de3d..41a1d795 100644 --- a/golang/main.go +++ b/golang/main.go @@ -1,15 +1,7 @@ package main -import ( - "fmt" - - func_ "isuct.ru/informatics2022/code" -) +import "fmt" func main() { - var a float64 = 2.0 - var xs = [8]float64{1.2, 4.2, 0.6, 1.16, 1.32, 1.47, 1.65, 1.93} - for _, x := range xs { - fmt.Println("y =", func_.Lab_4(a, x)) - } + fmt.Println("Медведева Виктория Александровна") } From 377321d066119fcc9a1ca7039d8b0eceae95e077 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 21 Dec 2024 11:20:44 +0300 Subject: [PATCH 04/15] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0=204,6,7=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D1=8B=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Informatics_2024 | 1 + golang/labs/lab4/lab4.go | 33 +++++++++++++++++++++++++++++++++ golang/labs/lab6/lab6.go | 29 +++++++++++++++++++++++++++++ golang/labs/lab7/clothes.go | 0 golang/labs/lab7/cosmetics.go | 0 golang/labs/lab7/food.go | 0 golang/labs/lab7/lab7.go | 0 golang/labs/lab7/product.go | 9 +++++++++ golang/main.go | 12 +++++++++++- 9 files changed, 83 insertions(+), 1 deletion(-) create mode 160000 Informatics_2024 create mode 100644 golang/labs/lab4/lab4.go create mode 100644 golang/labs/lab6/lab6.go create mode 100644 golang/labs/lab7/clothes.go create mode 100644 golang/labs/lab7/cosmetics.go create mode 100644 golang/labs/lab7/food.go create mode 100644 golang/labs/lab7/lab7.go create mode 100644 golang/labs/lab7/product.go diff --git a/Informatics_2024 b/Informatics_2024 new file mode 160000 index 00000000..f0237cff --- /dev/null +++ b/Informatics_2024 @@ -0,0 +1 @@ +Subproject commit f0237cffc24b67041be9a6feecd155945357649c diff --git a/golang/labs/lab4/lab4.go b/golang/labs/lab4/lab4.go new file mode 100644 index 00000000..851dcf8a --- /dev/null +++ b/golang/labs/lab4/lab4.go @@ -0,0 +1,33 @@ +import ( + "fmt" + "math" +) + +func RunLab4() { + a := 2.5 + b := 4.6 + fmt.Println(TaskA(1.1, 3.6, 0.5, a, b)) + arr := []float64{1.2, 1.28, 1.36, 1.46, 2.35} + fmt.Println(TaskB(arr, a, b)) +} + +func TaskA(xn, xk, deltax, a, b float64) []float64 { + var yValues []float64 + for x := xn; x <= xk; x += deltax { + yValues = append(yValues, CalculateY(x, a, b)) + } + return yValues +} + +func TaskB(values []float64, a, b float64) []float64 { + var yValues []float64 + for _, x := range values { + yValues = append(yValues, CalculateY(x, a, b)) + } + return yValues +} + +func CalculateY(x float64, a float64, b float64) float64 { + y := math.Pow(a+b*x, 2.5) / (1 + math.Log10(a+b*x)) + return y +} \ No newline at end of file diff --git a/golang/labs/lab6/lab6.go b/golang/labs/lab6/lab6.go new file mode 100644 index 00000000..69374b1c --- /dev/null +++ b/golang/labs/lab6/lab6.go @@ -0,0 +1,29 @@ +package lab6 + +import ( + "fmt" +) + +type Sydno struct { + width, height, osadka, polnota float64 +} + +func (t Sydno) Size() (float64, float64, float64, float64) { + return t.width, t.height, t.osadka, t.polnota +} + +func (t Sydno) CalculateArea() float64 { + return t.height * t.width +} + +func (t Sydno) Displacement() float64 { + return t.height * t.width * t.polnota +} + +func RunLab6() { + sydno := Sydno{2.45, 5.23, 7.34, 1.65} + width, height, osadka, polnota := sydno.Size() + fmt.Printf("Размеры судна: Ширина = %.2f, Высота = %.2f, Осадка судна = %.2f, Коэффициент полноты = %.2f\n", width, height, osadka, polnota) + fmt.Printf("Площадь судна: %.2f м²\n", sydno.CalculateArea()) + fmt.Printf("Водоизмещение судна: %.2f м³\n", sydno.Displacement()) +} diff --git a/golang/labs/lab7/clothes.go b/golang/labs/lab7/clothes.go new file mode 100644 index 00000000..e69de29b diff --git a/golang/labs/lab7/cosmetics.go b/golang/labs/lab7/cosmetics.go new file mode 100644 index 00000000..e69de29b diff --git a/golang/labs/lab7/food.go b/golang/labs/lab7/food.go new file mode 100644 index 00000000..e69de29b diff --git a/golang/labs/lab7/lab7.go b/golang/labs/lab7/lab7.go new file mode 100644 index 00000000..e69de29b diff --git a/golang/labs/lab7/product.go b/golang/labs/lab7/product.go new file mode 100644 index 00000000..226f0cdd --- /dev/null +++ b/golang/labs/lab7/product.go @@ -0,0 +1,9 @@ +package labs + +type Product interface { + Setdiscount(discount float64) + SetPrice(newPrice float64) + GetPrice() float64 + GetName() string + GetInfo() string +} diff --git a/golang/main.go b/golang/main.go index 41a1d795..ef2ed08e 100644 --- a/golang/main.go +++ b/golang/main.go @@ -1,7 +1,17 @@ package main -import "fmt" +import ( + "fmt" + + lab4 "isuct.ru/informatics2022/labs/lab4" + lab6 "isuct.ru/informatics2022/labs/lab6" + lab7 "isuct.ru/informatics2022/labs/lab7" +) func main() { fmt.Println("Медведева Виктория Александровна") + + lab4.RunLab4() + lab6.RunLab6() + lab7.RunLab7() } From f2463033487eb40793d6f84178c5a7446446ed0b Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 21 Dec 2024 12:00:23 +0300 Subject: [PATCH 05/15] 4,6,7 labs --- golang/labs/lab7/lab7.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/golang/labs/lab7/lab7.go b/golang/labs/lab7/lab7.go index e69de29b..584b706e 100644 --- a/golang/labs/lab7/lab7.go +++ b/golang/labs/lab7/lab7.go @@ -0,0 +1,33 @@ +package labs + +import "fmt" + +func CalculateProductsSum(products []Product) float64 { + var sum float64 = 0 + for _, product := range products { + sum += product.GetPrice() + } + return sum +} + +func RunLab7() { + potato := &Food{50.15, "картошка", "вкусвилл", 17} + lipstick := &Cosmetics{"помада", 1700, "Chanel"} + sweatshirt := &Clothes{"толстовка", 3000.99, "Levi`s", "хлопок", "осень"} + products := []Product{potato, lipstick, sweatshirt} + fmt.Println("Товары") + fmt.Println("Общая стоимость:", CalculateProductsSum(products), "рублей") + for _, product := range products { + fmt.Println(product.GetInfo()) + } + + for _, product := range products { + product.Setdiscount(20) + } + fmt.Println("Общая стоимость товаров после применения скидки 20%:", CalculateProductsSum(products), "рублей") + + fmt.Println("Информация про товар толстовка") + fmt.Println("материал:", sweatshirt.GetMaterial()) + fmt.Println("сезон:", sweatshirt.GetSeason()) + fmt.Println("бренд:", sweatshirt.GetBrand()) +} From 883c74cd313bb535932c2f3833d9521ea1217e3b Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 21 Dec 2024 12:12:20 +0300 Subject: [PATCH 06/15] =?UTF-8?q?=D0=A0=D0=B5=D1=88=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=204,=206,=207=20=D0=BB=D0=B0=D0=B1=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/labs/lab7/clothes.go | 40 +++++++++++++++++++++++++++++++++++ golang/labs/lab7/cosmetics.go | 27 +++++++++++++++++++++++ golang/labs/lab7/food.go | 28 ++++++++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/golang/labs/lab7/clothes.go b/golang/labs/lab7/clothes.go index e69de29b..9f798d83 100644 --- a/golang/labs/lab7/clothes.go +++ b/golang/labs/lab7/clothes.go @@ -0,0 +1,40 @@ +package labs + +import "fmt" + +type Clothes struct { + name string + price float64 + brand string + material string + season string +} + +func (c *Clothes) GetName() string { + return c.name +} + +func (c *Clothes) GetPrice() float64 { + return c.price +} + +func (c *Clothes) Setdiscount(discount float64) { + c.price -= c.price * discount / 100 +} + +func (c *Clothes) SetPrice(newPrice float64) { + c.price = newPrice +} + +func (c *Clothes) GetBrand() string { + return c.brand +} +func (c *Clothes) GetSeason() string { + return c.season +} +func (c *Clothes) GetMaterial() string { + return c.material +} +func (c *Clothes) GetInfo() string { + return fmt.Sprintf("Название: %s, Цена: %.2f, Бренд: %s, Материал: %s,Сезон: %s", c.name, c.price, c.brand, c.material, c.season) +} diff --git a/golang/labs/lab7/cosmetics.go b/golang/labs/lab7/cosmetics.go index e69de29b..0d6bb34b 100644 --- a/golang/labs/lab7/cosmetics.go +++ b/golang/labs/lab7/cosmetics.go @@ -0,0 +1,27 @@ +package labs + +import "fmt" + +type Cosmetics struct { + name string + price float64 + brand string +} + +func (c *Cosmetics) GetName() string { + return c.name +} +func (c *Cosmetics) GetPrice() float64 { + return c.price +} + +func (c *Cosmetics) Setdiscount(discount float64) { + c.price -= c.price * discount / 100 +} + +func (c *Cosmetics) SetPrice(newPrice float64) { + c.price = newPrice +} +func (c *Cosmetics) GetInfo() string { + return fmt.Sprintf("Название: %s, Бренд: %s, Цена: %.2f", c.name, c.brand, c.price) +} diff --git a/golang/labs/lab7/food.go b/golang/labs/lab7/food.go index e69de29b..518fdbbd 100644 --- a/golang/labs/lab7/food.go +++ b/golang/labs/lab7/food.go @@ -0,0 +1,28 @@ +package labs + +import "fmt" + +type Food struct { + price float64 + name string + brand string + calories int +} + +func (f *Food) GetName() string { + return f.name +} +func (f *Food) GetPrice() float64 { + return f.price +} + +func (f *Food) Setdiscount(discount float64) { + f.price -= f.price * discount / 100 +} + +func (f *Food) SetPrice(newPrice float64) { + f.price = newPrice +} +func (f *Food) GetInfo() string { + return fmt.Sprintf("Название: %s, Цена: %.2f, Калорийность: %d , Бренд: %s", f.name, f.price, f.calories, f.brand) +} From d9f8cd55018a4198288d314543799dcb08de4325 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Thu, 26 Dec 2024 11:00:59 +0300 Subject: [PATCH 07/15] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0=206=20=D0=B8=207=20=D0=BB=D0=B0=D0=B1=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/labs/lab6/lab6.go | 38 ++++++++++++++++++++++++------------- golang/labs/lab7/clothes.go | 2 +- golang/labs/lab7/food.go | 2 +- golang/labs/lab7/lab7.go | 2 +- golang/labs/lab7/product.go | 2 +- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/golang/labs/lab6/lab6.go b/golang/labs/lab6/lab6.go index 69374b1c..a6c60343 100644 --- a/golang/labs/lab6/lab6.go +++ b/golang/labs/lab6/lab6.go @@ -4,26 +4,38 @@ import ( "fmt" ) -type Sydno struct { - width, height, osadka, polnota float64 +type Mouse struct { + Name string + Age int + Weight float64 } -func (t Sydno) Size() (float64, float64, float64, float64) { - return t.width, t.height, t.osadka, t.polnota +func NewMouse(name string, age int, weight float64) Mouse { + return Mouse{Name: name, Age: age, Weight: weight} } -func (t Sydno) CalculateArea() float64 { - return t.height * t.width +func (r *Mouse) GetAge() int { + return r.Age } -func (t Sydno) Displacement() float64 { - return t.height * t.width * t.polnota +func (r *Mouse) SetAge(age int) { + if age > 0 { + r.Age = age + } +} + +func (r Mouse) Info() string { + return fmt.Sprintf("Имя: %s, Возраст: %d, Вес: %.2f кг", r.Name, r.Age, r.Weight) } func RunLab6() { - sydno := Sydno{2.45, 5.23, 7.34, 1.65} - width, height, osadka, polnota := sydno.Size() - fmt.Printf("Размеры судна: Ширина = %.2f, Высота = %.2f, Осадка судна = %.2f, Коэффициент полноты = %.2f\n", width, height, osadka, polnota) - fmt.Printf("Площадь судна: %.2f м²\n", sydno.CalculateArea()) - fmt.Printf("Водоизмещение судна: %.2f м³\n", sydno.Displacement()) + mouse := NewMouse("Гена", 2, 1.5) + + fmt.Println(mouse.Info()) + + mouse.SetAge(3) + + fmt.Printf("Обновленный возраст: %d\n", mouse.GetAge()) + + fmt.Println(mouse.Info()) } diff --git a/golang/labs/lab7/clothes.go b/golang/labs/lab7/clothes.go index 9f798d83..00a53183 100644 --- a/golang/labs/lab7/clothes.go +++ b/golang/labs/lab7/clothes.go @@ -18,7 +18,7 @@ func (c *Clothes) GetPrice() float64 { return c.price } -func (c *Clothes) Setdiscount(discount float64) { +func (c *Clothes) SetDiscount(discount float64) { c.price -= c.price * discount / 100 } diff --git a/golang/labs/lab7/food.go b/golang/labs/lab7/food.go index 518fdbbd..0871eb91 100644 --- a/golang/labs/lab7/food.go +++ b/golang/labs/lab7/food.go @@ -16,7 +16,7 @@ func (f *Food) GetPrice() float64 { return f.price } -func (f *Food) Setdiscount(discount float64) { +func (f *Food) SetDiscount(discount float64) { f.price -= f.price * discount / 100 } diff --git a/golang/labs/lab7/lab7.go b/golang/labs/lab7/lab7.go index 584b706e..a2e53d23 100644 --- a/golang/labs/lab7/lab7.go +++ b/golang/labs/lab7/lab7.go @@ -22,7 +22,7 @@ func RunLab7() { } for _, product := range products { - product.Setdiscount(20) + product.SetDiscount(20) } fmt.Println("Общая стоимость товаров после применения скидки 20%:", CalculateProductsSum(products), "рублей") diff --git a/golang/labs/lab7/product.go b/golang/labs/lab7/product.go index 226f0cdd..cb3bd517 100644 --- a/golang/labs/lab7/product.go +++ b/golang/labs/lab7/product.go @@ -1,7 +1,7 @@ package labs type Product interface { - Setdiscount(discount float64) + SetDiscount(discount float64) SetPrice(newPrice float64) GetPrice() float64 GetName() string From 0c26ad2696ac02264d10583a92f3e304a2373e06 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Thu, 26 Dec 2024 11:31:13 +0300 Subject: [PATCH 08/15] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=206=20=D0=B8=207=20=D0=BB=D0=B0=D0=B1?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/labs/lab7/cosmetics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/labs/lab7/cosmetics.go b/golang/labs/lab7/cosmetics.go index 0d6bb34b..93daf823 100644 --- a/golang/labs/lab7/cosmetics.go +++ b/golang/labs/lab7/cosmetics.go @@ -15,7 +15,7 @@ func (c *Cosmetics) GetPrice() float64 { return c.price } -func (c *Cosmetics) Setdiscount(discount float64) { +func (c *Cosmetics) SetDiscount(discount float64) { c.price -= c.price * discount / 100 } From 7092f3c6abe18d2b90174785d5bca252fc4723fb Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Thu, 26 Dec 2024 16:18:42 +0300 Subject: [PATCH 09/15] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0=204=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BD=D1=83=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/labs/lab4/lab4.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/golang/labs/lab4/lab4.go b/golang/labs/lab4/lab4.go index 851dcf8a..5de6832e 100644 --- a/golang/labs/lab4/lab4.go +++ b/golang/labs/lab4/lab4.go @@ -1,3 +1,5 @@ +package lab4 + import ( "fmt" "math" @@ -6,12 +8,12 @@ import ( func RunLab4() { a := 2.5 b := 4.6 - fmt.Println(TaskA(1.1, 3.6, 0.5, a, b)) + fmt.Println(taska(1.1, 3.6, 0.5, a, b)) arr := []float64{1.2, 1.28, 1.36, 1.46, 2.35} - fmt.Println(TaskB(arr, a, b)) + fmt.Println(taskb(arr, a, b)) } -func TaskA(xn, xk, deltax, a, b float64) []float64 { +func taska(xn, xk, deltax, a, b float64) []float64 { var yValues []float64 for x := xn; x <= xk; x += deltax { yValues = append(yValues, CalculateY(x, a, b)) @@ -19,7 +21,7 @@ func TaskA(xn, xk, deltax, a, b float64) []float64 { return yValues } -func TaskB(values []float64, a, b float64) []float64 { +func taskb(values []float64, a, b float64) []float64 { var yValues []float64 for _, x := range values { yValues = append(yValues, CalculateY(x, a, b)) @@ -30,4 +32,4 @@ func TaskB(values []float64, a, b float64) []float64 { func CalculateY(x float64, a float64, b float64) float64 { y := math.Pow(a+b*x, 2.5) / (1 + math.Log10(a+b*x)) return y -} \ No newline at end of file +} From 58f9a68812dfd58606de91f918e3b095d4f1a5a3 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 28 Dec 2024 09:24:29 +0300 Subject: [PATCH 10/15] =?UTF-8?q?=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=BB=D0=B0=207=20=D0=BB=D0=B0=D0=B1=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golang/labs/lab7/clothes.go | 4 ++-- golang/labs/lab7/cosmetics.go | 2 +- golang/labs/lab7/food.go | 2 +- golang/labs/lab7/lab7.go | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/golang/labs/lab7/clothes.go b/golang/labs/lab7/clothes.go index 00a53183..0b2a0ceb 100644 --- a/golang/labs/lab7/clothes.go +++ b/golang/labs/lab7/clothes.go @@ -35,6 +35,6 @@ func (c *Clothes) GetSeason() string { func (c *Clothes) GetMaterial() string { return c.material } -func (c *Clothes) GetInfo() string { - return fmt.Sprintf("Название: %s, Цена: %.2f, Бренд: %s, Материал: %s,Сезон: %s", c.name, c.price, c.brand, c.material, c.season) +func (c *Clothes) GetInf() string { + return fmt.Sprintf("название: %s, цена: %.2f, бренд: %s, материал: %s,сезон: %s", c.name, c.price, c.brand, c.material, c.season) } diff --git a/golang/labs/lab7/cosmetics.go b/golang/labs/lab7/cosmetics.go index 93daf823..631c51ff 100644 --- a/golang/labs/lab7/cosmetics.go +++ b/golang/labs/lab7/cosmetics.go @@ -23,5 +23,5 @@ func (c *Cosmetics) SetPrice(newPrice float64) { c.price = newPrice } func (c *Cosmetics) GetInfo() string { - return fmt.Sprintf("Название: %s, Бренд: %s, Цена: %.2f", c.name, c.brand, c.price) + return fmt.Sprintf("название: %s, бренд: %s, цена: %.2f", c.name, c.brand, c.price) } diff --git a/golang/labs/lab7/food.go b/golang/labs/lab7/food.go index 0871eb91..e800692a 100644 --- a/golang/labs/lab7/food.go +++ b/golang/labs/lab7/food.go @@ -24,5 +24,5 @@ func (f *Food) SetPrice(newPrice float64) { f.price = newPrice } func (f *Food) GetInfo() string { - return fmt.Sprintf("Название: %s, Цена: %.2f, Калорийность: %d , Бренд: %s", f.name, f.price, f.calories, f.brand) + return fmt.Sprintf("название: %s, цена: %.2f, каллории: %d , бренд: %s", f.name, f.price, f.calories, f.brand) } diff --git a/golang/labs/lab7/lab7.go b/golang/labs/lab7/lab7.go index a2e53d23..1109a6ba 100644 --- a/golang/labs/lab7/lab7.go +++ b/golang/labs/lab7/lab7.go @@ -11,23 +11,23 @@ func CalculateProductsSum(products []Product) float64 { } func RunLab7() { - potato := &Food{50.15, "картошка", "вкусвилл", 17} - lipstick := &Cosmetics{"помада", 1700, "Chanel"} - sweatshirt := &Clothes{"толстовка", 3000.99, "Levi`s", "хлопок", "осень"} - products := []Product{potato, lipstick, sweatshirt} - fmt.Println("Товары") - fmt.Println("Общая стоимость:", CalculateProductsSum(products), "рублей") + carrot := &Food{50.15, "морковь", "магнит", 17} + mascara := &Cosmetics{"тушь для ресниц", 1700, "loreal paris"} + shirt := &Clothes{"рубашка", 3000.99, "Levi`s", "синтетика", "весна"} + products := []Product{carrot, mascara, shirt} + fmt.Println("товары") + fmt.Println("общая стоимость:", CalculateProductsSum(products), "рублей") for _, product := range products { - fmt.Println(product.GetInfo()) + fmt.Println(product.GetInf()) } for _, product := range products { product.SetDiscount(20) } - fmt.Println("Общая стоимость товаров после применения скидки 20%:", CalculateProductsSum(products), "рублей") + fmt.Println("общая стоимость товаров после применения скидки 20%:", CalculateProductsSum(products), "рублей") - fmt.Println("Информация про товар толстовка") - fmt.Println("материал:", sweatshirt.GetMaterial()) - fmt.Println("сезон:", sweatshirt.GetSeason()) - fmt.Println("бренд:", sweatshirt.GetBrand()) + fmt.Println("информация про товар рубашка") + fmt.Println("материал:", shirt.GetMat()) + fmt.Println("сезон:", shirt.GetSeason()) + fmt.Println("бренд:", shirt.GetBrand()) } From bd84bdd33a60b7372e18d3ecc14a0210f0ee9a53 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 28 Dec 2024 09:32:29 +0300 Subject: [PATCH 11/15] Update clothes.go --- golang/labs/lab7/clothes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/labs/lab7/clothes.go b/golang/labs/lab7/clothes.go index 0b2a0ceb..01737183 100644 --- a/golang/labs/lab7/clothes.go +++ b/golang/labs/lab7/clothes.go @@ -32,7 +32,7 @@ func (c *Clothes) GetBrand() string { func (c *Clothes) GetSeason() string { return c.season } -func (c *Clothes) GetMaterial() string { +func (c *Clothes) GetMat() string { return c.material } func (c *Clothes) GetInf() string { From 6404a8a5a1a8baf9ea125443b11a79e24eb4a1e4 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 28 Dec 2024 09:36:18 +0300 Subject: [PATCH 12/15] Update product.go --- golang/labs/lab7/product.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/labs/lab7/product.go b/golang/labs/lab7/product.go index cb3bd517..dbf38e30 100644 --- a/golang/labs/lab7/product.go +++ b/golang/labs/lab7/product.go @@ -5,5 +5,5 @@ type Product interface { SetPrice(newPrice float64) GetPrice() float64 GetName() string - GetInfo() string + GetInf() string } From 7d1678158fdd5854be2a58059248a258ec3a6f6a Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 28 Dec 2024 09:37:24 +0300 Subject: [PATCH 13/15] Update food.go --- golang/labs/lab7/food.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/labs/lab7/food.go b/golang/labs/lab7/food.go index e800692a..29ecbd6b 100644 --- a/golang/labs/lab7/food.go +++ b/golang/labs/lab7/food.go @@ -23,6 +23,6 @@ func (f *Food) SetDiscount(discount float64) { func (f *Food) SetPrice(newPrice float64) { f.price = newPrice } -func (f *Food) GetInfo() string { +func (f *Food) GetInf() string { return fmt.Sprintf("название: %s, цена: %.2f, каллории: %d , бренд: %s", f.name, f.price, f.calories, f.brand) } From b139a47ddc241d599de10cdd50763faaac33c17b Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 28 Dec 2024 09:38:24 +0300 Subject: [PATCH 14/15] Update cosmetics.go --- golang/labs/lab7/cosmetics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/labs/lab7/cosmetics.go b/golang/labs/lab7/cosmetics.go index 631c51ff..715d61e5 100644 --- a/golang/labs/lab7/cosmetics.go +++ b/golang/labs/lab7/cosmetics.go @@ -22,6 +22,6 @@ func (c *Cosmetics) SetDiscount(discount float64) { func (c *Cosmetics) SetPrice(newPrice float64) { c.price = newPrice } -func (c *Cosmetics) GetInfo() string { +func (c *Cosmetics) GetInf() string { return fmt.Sprintf("название: %s, бренд: %s, цена: %.2f", c.name, c.brand, c.price) } From 41eeaa10c2d0708d5bc4220f1b9a79cf092b8ed5 Mon Sep 17 00:00:00 2001 From: Viktoria3284 Date: Sat, 28 Dec 2024 09:39:22 +0300 Subject: [PATCH 15/15] Update main.go --- golang/main.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/golang/main.go b/golang/main.go index aaf7b8d4..1b9070c7 100644 --- a/golang/main.go +++ b/golang/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - lab4 "isuct.ru/informatics2022/labs/lab4" lab6 "isuct.ru/informatics2022/labs/lab6" lab7 "isuct.ru/informatics2022/labs/lab7" @@ -10,11 +9,7 @@ import ( func main() { fmt.Println("Медведева Виктория Александровна") - - lab4.RunLab4() lab6.RunLab6() lab7.RunLab7() - - }