-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lab67 #610
Open
Viktoria3284
wants to merge
11
commits into
ISUCT:Medvedeva_Viktoriia
Choose a base branch
from
Viktoria3284:lab67
base: Medvedeva_Viktoriia
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Lab67 #610
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8ae500f
выполнила 4 лабораторная
Viktoria3284 ca0e3a1
выполнила 4 лабораторная
Viktoria3284 7a2f88c
сделала 3 лабораторную
Viktoria3284 377321d
сделала 4,6,7 лабораторные
Viktoria3284 f246303
4,6,7 labs
Viktoria3284 883c74c
Решение 4, 6, 7 лабы
Viktoria3284 d9f8cd5
Исправила 6 и 7 лабы
Viktoria3284 0c26ad2
исправлены 6 и 7 лабы
Viktoria3284 95909b4
Merge branch 'Medvedeva_Viktoriia' into lab67
Viktoria3284 a9c0766
Update lab4.go
Viktoria3284 ece48bf
Update main.go
Viktoria3284 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule Informatics_2024
added at
f0237c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package lab4 | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package lab6 | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
type Mouse struct { | ||
Name string | ||
Age int | ||
Weight float64 | ||
} | ||
|
||
func NewMouse(name string, age int, weight float64) Mouse { | ||
return Mouse{Name: name, Age: age, Weight: weight} | ||
} | ||
|
||
func (r *Mouse) GetAge() int { | ||
return r.Age | ||
} | ||
|
||
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() { | ||
mouse := NewMouse("Гена", 2, 1.5) | ||
|
||
fmt.Println(mouse.Info()) | ||
|
||
mouse.SetAge(3) | ||
|
||
fmt.Printf("Обновленный возраст: %d\n", mouse.GetAge()) | ||
|
||
fmt.Println(mouse.Info()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package labs | ||
|
||
type Product interface { | ||
SetDiscount(discount float64) | ||
SetPrice(newPrice float64) | ||
GetPrice() float64 | ||
GetName() string | ||
GetInfo() string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
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() | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Удалить папку