Skip to content
Open

Lab 6 #569

Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions golang/lab6/lab6.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package lab6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не ваш вариант, переделать


import "fmt"

type Plane struct {
Name string
Color string
Speed int
}

func NewPlane(name, color string, speed int) *Plane {
plane := new(Plane)
plane.Name = name
plane.Color = color
plane.Speed = speed
return plane
}

func (p Plane) GetName() string {
return p.Name
}

func (p Plane) GetColor() string {
return p.Color
}

func (p *Plane) SetSpeed(speed int) {
p.Speed = speed
}

func Lab6() {
boeing := NewPlane("Boeing", "Белый", 120)
boeing.SetSpeed(150)
fmt.Println(boeing.GetName())
fmt.Println(boeing.GetColor())
}
2 changes: 2 additions & 0 deletions golang/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"fmt"

"isuct.ru/informatics2022/lab4"
"isuct.ru/informatics2022/lab6"
)

func main() {
fmt.Println("Емельчиков Егор Павлович")
fmt.Println("Задача А:\n", lab4.TaskA(0.7, 2.2, 0.3))
fmt.Println("Задача B:\n", lab4.TaskB([]float64{0.25, 0.36, 0.56, 0.94, 1.28}))
lab6.Lab6()
}