De presentatie wordt gedownload. Even geduld aub

De presentatie wordt gedownload. Even geduld aub

Aangepaste timing nTheorie (16 colleges + 2 deeltentamens) nPraktijk (16 keer, 3 inleveropdrachten) college Tent. 1 Tent. 3 college prakt. 1 prakt. 3 prakt.

Verwante presentaties


Presentatie over: "Aangepaste timing nTheorie (16 colleges + 2 deeltentamens) nPraktijk (16 keer, 3 inleveropdrachten) college Tent. 1 Tent. 3 college prakt. 1 prakt. 3 prakt."— Transcript van de presentatie:

1 Aangepaste timing nTheorie (16 colleges + 2 deeltentamens) nPraktijk (16 keer, 3 inleveropdrachten) college Tent. 1 Tent. 3 college prakt. 1 prakt. 3 prakt. prakt. 1 prakt. prakt. 2 prakt. 3 werkcoll nOefening (4 werkcolleges) college prakt. 3 werkcoll collegeprakt. prakt. 1 prakt. 2 prakt. prakt. 1

2 Groeps-indeling Practicum / Werkcollege Niet zoals in Osiris, maar: nB017 / B023: kappa, lambda nB020 / B023: mu, pi nB106 / B083: rho, sigma nB175 / B083: tau, phi, psi, omega, overige 1ejaars nR116 / B201: tweedejaars, keuzevak, premaster nM205 / B201: ouderejaars

3 Nieuwe methoden nMethode: groepje opdrachten met een naam Aanroep van een methode voert opdrachten uit in de body daarvan private void tekenHuis(…) { …. DrawRect (…); …. DrawLine (…); …. DrawLine (…); } protected override void OnDraw(Canvas c) { …. tekenHuis (…); …. tekenHuis (…); …. tekenHuis (…); }

4 Meer parameters c.DrawRect ( …, verf); c.DrawLine ( …, verf); c.DrawLine ( …, verf); } x, y-br, x+br, y int tx = x+br/2; int ty = y–br–br/2; x, y-br, tx, ty tx, ty, x+br, y-br private void tekenHuis (Canvas c, … ) { Paint verf = new Paint(); int x, int y, int br) this. tekenHuis (c, …); this. tekenHuis (c, …); this. tekenHuis (c, …); } protected override void OnDraw(Canvas c) { (x,y)br (tx,ty) 20, 100, 40); 70, 100, 40); 120, 100, 60);

5 Communicatie met methoden nParameters : aanroeper geeft waarde door aan de methode nMethode-resultaat : methode geeft waarde terug aan de aanroeper net zoals een wiskundige functie

6 Methoden met een resultaat private double kwadraat (double x) { return x*x ; } type van het resultaat waarde van het resultaat in speciale return-opdracht

7 Publieksvraag nSchrijf methodes omtrek en diagonaal met een Rect als parameter, die dat uitrekenen public int omtrek (Rect r) { } return 2*(br+h); Left Top Right Bottom int br = r.Right-r.Left; int h = r.Bottom-r.Top; br h public double diagonaal(Rect r) { } return Math.Sqrt(a*a + b*b); int a = r.Right-r.Left; int b = r.Bottom-r.Top; a 2 + b 2 = c 2

8 Programma opdrachten methoden klasse variabelen en Geheugen objecten klasse zijn gegroepeerd in hebben als type veranderen bewerken

9 Values versus Pointers Color c; Rect r; class Rect struct Color c 0 0 R G 0 B 255 10 30 Left Right 20 Top 40 Bottom c = new Color(255,0,0); new Rect(10,20,30,40); null r r =

10 Type-controle nCompiler controleert type van toe te kennen waardes int x, y ; double d; Color c; x = 3; x = y; d = 3.14; c = Color.Red; x = 3.14; x = “hoi”; d = c; c = 3;

11 Type-conversie getallen int x, y ; double c, d; x = 5; d = 3.14; d = 7; c = x; x = (int) d; y = (int) (c/2); ntype klopt nint-waarde past ook in een double-variabele ndouble past afgekapt in int, mits programmeur accoord

12 Type-controle parameters nCompiler controleert of parameters van methoden het goede type hebben c.DrawText ( ”hallo”, 10, 20, verf ); x = 100; y = 10; waarde = 37; c.DrawText ( waarde, 0.3 * x, y, verf );.ToString() (int)( ) String int Paint

13 -syntax expressie getal expressie operator expressie() variabele ”” symbool object expressie (), new klasse naam property naam this klasse naam methode naam.

14 Syntax van opdrachten opdracht (), ;expressie klasse naam object expressie. methode naam =expressie;variabele property naam += returnexpressie;

15 Klikker protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { knop = new Button(this); knop.Click += klik; this.SetContentView(knop); public void klik(object o, EventArgs ea) { } knop.Text = "1x geklikt"; } Button knop;

16 Klikker Schilderij protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { scherm = new MijnView(this); knop.Click += klik; this.SetContentView(scherm); public void klik(object o, EventArgs ea) { } knop.Text = "1x geklikt"; } MijnView scherm;

17 Schilderij protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { scherm = new MijnView(this); this.SetContentView(scherm); } MijnView scherm; } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { } c.DrawLine(...); class MijnView : View scherm.Click += klik;

18 A-Touch protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { scherm = new MijnView(this); this.SetContentView(scherm); } MijnView scherm; } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { } c.DrawLine(...); class MijnView : View scherm.Touch += raakAan; public void raakAan(object o, EventArgs ea) { }

19 A-Touch V-Touch protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { scherm = new MijnView(this); this.SetContentView(scherm); } MijnView scherm; } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { } c.DrawLine(...); class MijnView : View scherm.Touch += raakAan; public void raakAan(object o, EventArgs ea) { } this.Touch += raakAan; public void raakAan(object o, EventArgs ea) { }

20 V-Touch protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { scherm = new MijnView(this); this.SetContentView(scherm); } MijnView scherm; } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { } c.DrawLine(...); class MijnView : View this.Touch += raakAan; public void raakAan(object o, EventArgs ea) { }

21 V-Touch protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { scherm = new MijnView(this); this.SetContentView(new MijnView(this)); } MijnView scherm; } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { } c.DrawLine(...); class MijnView : View this.Touch += raakAan; public void raakAan(object o, EventArgs ea) { }

22 Cirkel- klikker protected override void OnCreate(Bundle b) { base.OnCreate(b); class MijnAct : Activity } { this.SetContentView(new MijnView(this)); } } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { } c.DrawLine(...); class MijnView : View this.Touch += raakAan; public void raakAan(object o, EventArgs ea) { }

23 Cirkel- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawCircle(x, y, 50, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p;

24 Cirkel- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawCircle(x, y, 50, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y);

25 Cirkel- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawCircle(p.X, p.Y, 50, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); if (p ≠ null)

26 Cirkel- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawCircle(p.X, p.Y, 50, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); if (p != null)

27 Opdrachten voorwaardelijk uitvoeren opdracht wordt alleen uitgevoerd als voorwaarde geldt if (temperatuur<0) uitvoer.Text = "Het vriest!"; opdracht wordt steeds opnieuw uitgevoerd zolang voorwaarde geldt if while (temperatuur<0) temperatuur += 5;

28 Twee alternatieven opdracht wordt alleen uitgevoerd als voorwaarde niet geldt if (temperatuur<0) uitvoer.Text = "Het vriest!”; else uitvoer.Text = "Het dooit.";

29 Meer opdrachten als body accolades maken twee opdrachten tot één body if (temperatuur<0) uitvoer1.Text = "Het vriest"; uitvoer2.Text = "Koud he!"; {}{}

30 Vergelijk-operatoren n<kleiner dan n<=kleiner dan of gelijk aan n>groter dan n>=groter dan of gelijk aan n==gelijk aan n!=ongelijk aan x=5 x wordt 5 ! x==5 is x gelijk aan 5 ?

31 Expressies nExpressie met een getal als waarde nExpressie met een tekst als waarde nExpressie met een waarheid als waarde 2 * (lengte + breedte) "Hallo " + persoon p != null type int type bool type string value object- value

32 Bool expressies nVergelijken van waarden nCombineren van andere bool-expressies met logische operatoren u&&and u||or u !not x <= y x 0 ! (x==0 && y==0)x!=0 || y!=0 George Boole (1815-1864)

33 Syntax van opdrachten opdracht (), ;expressie klasse naam object expressie. methode naam =expressie;variabele property naam += returnexpressie; if)(expressieopdrachtblok opdrachtelse

34 Cirkel- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawCircle(p.X, p.Y, 50, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); if (p != null)

35 Cirkel- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawBitmap(b, p.X, p.Y, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); if (p != null) met bitmap b = BitmapFactory.DecodeResource (...Icon...); Bitmap b;

36 Resources

37 Punten- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawBitmap(b, p.X, p.Y, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); if (p != null) met bitmap b = BitmapFactory.DecodeResource (...Icon...); Bitmap b; List alles ;

38 Punten- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawBitmap(b, p.X, p.Y, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); if (p != null) met bitmap b = BitmapFactory.DecodeResource (...Icon...); Bitmap b; List alles ; alles.Add(p);

39 Punten- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawBitmap(b, p.X, p.Y, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); foreach( PointF p in alles) met bitmap b = BitmapFactory.DecodeResource (...Icon...); Bitmap b; List alles ; alles.Add(p);

40 Punten- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawBitmap(b, p.X, p.Y, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); foreach( PointF p in alles) met bitmap b = BitmapFactory.DecodeResource (...Icon...); Bitmap b; List alles = new List ( ) ; alles.Add(p);

41 Punten- klikker } { protected override void OnDraw(Canvas c) { base.OnDraw(c); } public MijnView(Context c) : base(c) { this.Touch += raakAan; } class MijnView : View public void raakAan(object o, TouchEventArgs tea) { } } c.DrawBitmap(b, p.X, p.Y, new Paint()); x = tea.Event.GetX(); y = tea.Event.GetY(); this.Invalidate(); float x, y; PointF p; p = new PointF(x, y); foreach( PointF p in alles) met bitmap b = BitmapFactory.DecodeResource (...Icon...); Bitmap b; List alles = new List ( ) ; alles.Add(p);

42 Punten- klikker protected override void OnDraw(Canvas c) { base.OnDraw(c); } public void raakAan(object o, c.DrawBitmap(b, p.X, p.Y, new Paint()); foreach( PointF p in alles) met bitmap } RectF grens; Paint verf = new Paint(); verf.Color=Color.Blue; c.DrawRect(grens, verf); grens.Union(p.X, p.Y); } {

43 Punten- klikker protected override void OnDraw(Canvas c) { base.OnDraw(c); } public void raakAan(object o, c.DrawBitmap(b, p.X, p.Y, new Paint()); foreach( PointF p in alles) met bitmap } RectF grens = null; Paint verf = new Paint(); verf.Color=Color.Blue; c.DrawRect(grens, verf); grens.Union(p.X, p.Y); grens = new RectF(p.X, p.Y, p.X, p.Y); } { if (grens==null) else if (grens != null) { }

44 Syntax van opdrachten opdracht (), ;expressie klasse naam object expressie. methode naam =expressie;variabele property naam += returnexpressie; if)(expressieopdrachtblok opdrachtelse typeexprinnaamforeach()opdracht


Download ppt "Aangepaste timing nTheorie (16 colleges + 2 deeltentamens) nPraktijk (16 keer, 3 inleveropdrachten) college Tent. 1 Tent. 3 college prakt. 1 prakt. 3 prakt."

Verwante presentaties


Ads door Google