diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..5c7247b4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,7 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [] +} \ No newline at end of file diff --git a/golang/go.mod b/golang/go.mod index d1cc943c..5cecc1f3 100644 --- a/golang/go.mod +++ b/golang/go.mod @@ -1,5 +1,3 @@ module isuct.ru/informatics2022 go 1.16 - -require github.com/stretchr/testify v1.8.1 diff --git a/golang/go.sum b/golang/go.sum index 2ec90f70..e69de29b 100644 --- a/golang/go.sum +++ b/golang/go.sum @@ -1,17 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/golang/lab6/lab6.go b/golang/lab6/lab6.go new file mode 100644 index 00000000..da925c80 --- /dev/null +++ b/golang/lab6/lab6.go @@ -0,0 +1,34 @@ +package lab6 + +import "fmt" + +type Telephone struct { + Model string + Weight float64 + display_size float64 +} + +func NewTelephone(Model string, Weight, display_size float64) Telephone { + return Telephone{ + Model: Model, + Weight: Weight, + display_size: display_size, + } +} + +func (f Telephone) Info() string { + return fmt.Sprintf("Модель: %s Вес модели: %f, Размер дисплея модели: %f минут", f.Model, f.Weight, f.display_size) +} +func (f *Telephone) UpdateModel(newModel string) { + f.Model = newModel +} +func (f Telephone) Buy() { + fmt.Printf("Вы купили телефон модели:%s веса:%f у которого размер дисплея:%f", f.Model, f.Weight, f.display_size) +} +func ExecuteLab6() { + Telephone := NewTelephone("Iphone 15 Pro Max", 0.221, 6.7) + Telephone.Buy() + fmt.Println(Telephone.Info()) + Telephone.UpdateModel("Iphone 16") + fmt.Println(Telephone.Info()) +} diff --git a/golang/main.go b/golang/main.go index 593b09a6..e5f8aa26 100644 --- a/golang/main.go +++ b/golang/main.go @@ -1,7 +1,14 @@ package main -import "fmt" +import ( + "fmt" + + "isuct.ru/informatics2022/lab4" + "isuct.ru/informatics2022/lab6" +) func main() { fmt.Println("Fedorov Max Denisovich ") + lab6.ExecuteLab6() + lab4.RunLab4() }