File tree Expand file tree Collapse file tree 4 files changed +68
-2
lines changed Expand file tree Collapse file tree 4 files changed +68
-2
lines changed Original file line number Diff line number Diff line change 222216 . Interfaces ✓
232317 . Goroutines ✓
242418 . Channels ✓
25- 19 . Create Yourself Package ✘
25+ 19 . Create Yourself Package ✓
262620 . Test Package ✘
272721 . Grafik çizdirmek ✘
282822 . Arayüz Tasarımı GoLang ✘
Original file line number Diff line number Diff line change 242416 . Interfaces ✓
252517 . Goroutines ✓
262618 . Channels ✓
27- 19 . Create Yourself Package ✘
27+ 19 . Create Yourself Package ✓
282820 . Test Package ✘
292921 . Draw Graph on GoLang ✘
303022 . Gui on GoLang ✘
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "plateLib"
6+ )
7+
8+
9+ func main () {
10+ plate := plateLib.Plate {}
11+ plate .InitPlate ("Çiçek" )
12+
13+ fmt .Printf ("%s\n " ,plate .GetName ())
14+
15+ fmt .Printf ("Water: %.2f\n " ,plate .GetWater ())
16+ plate .Water ()
17+ fmt .Printf ("Water: %.2f\n " ,plate .GetWater ())
18+
19+ fmt .Printf ("Mineral :%.2f\n " ,plate .GetMineral ())
20+ plate .Mineral ()
21+ fmt .Printf ("Mineral :%.2f\n " ,plate .GetMineral ())
22+ }
Original file line number Diff line number Diff line change 1+ //You need to add this file in $GOPATH
2+ package plateLib
3+
4+ type Plate struct {
5+ Pid string
6+ wRatio float64 //water Ratio
7+ mRatio float64 //mineral Ratio
8+ oxygen float64
9+ }
10+
11+ func (p * Plate ) InitPlate (PId string ) {
12+ p .Pid = PId
13+ p .wRatio = 0.76
14+ p .mRatio = 0.65
15+ p .oxygen = 0.44532
16+ }
17+
18+ func (p * Plate ) Water () float64 {
19+ for p .wRatio < 0.8 {
20+ //Open the water line (cycle)
21+ p .wRatio += 0.01 ;
22+ }
23+ return p .wRatio
24+ }
25+
26+ func (p * Plate ) Mineral ()float64 {
27+ for p .mRatio < 0.8 {
28+ //Open the mineral line (cycle)
29+ p .mRatio += 0.01 ;
30+ }
31+ return p .mRatio
32+ }
33+ func (p * Plate ) oxySensor () {
34+ p .oxygen = 0.76 //Analog to Digital
35+ }
36+ func (p * Plate ) GetName () string {
37+ return p .Pid
38+ }
39+ func (p * Plate ) GetMineral () float64 {
40+ return p .mRatio
41+ }
42+ func (p * Plate ) GetWater () float64 {
43+ return p .wRatio
44+ }
You can’t perform that action at this time.
0 commit comments