Software Programming and FundamentalsRecap what we covered in week #1<br />
Variable<br />Variable:  imagine like a box to store one thing (data)<br />Eg: int age;<br />         age = 5;<br />
Variable<br />Variable:  imagine like a box to store one thing (data)<br />Eg: int age;<br />         age = 5;<br />int - ...
Variable<br />Variable:  imagine like a box to store one thing (data)<br />Eg: int age;<br />         age = 5;<br />int - ...
Variable<br />Variable:  imagine like a box to store one thing (data)<br />Eg: int age;<br />         age = 5;<br />5<br /...
Value Type Vs Reference Type<br />Variables:  two types<br />Value type (simple type like what you just saw)<br />Only nee...
Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br />         john = new Human();<br />...
Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br />         john = new Human();<br />...
john<br />Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br />         john = new Huma...
Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br />         john = new Human();<br />...
Non-Static Vs Static Class<br />Non-Static: need New() to instantiate / create an object – like what you see just now<br /...
Using Console Program for problem solving<br />Console program:<br />Simple<br />Procedural (from top to bottom)<br />Gett...
Upcoming SlideShare
Loading in …5
×

Variables - Value and Reference Type

1,075 views

Published on

Variables - Value and Reference Type, Non-Static Vs Static Classes

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,075
On SlideShare
0
From Embeds
0
Number of Embeds
183
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Variables - Value and Reference Type

  1. 1. Software Programming and FundamentalsRecap what we covered in week #1<br />
  2. 2. Variable<br />Variable: imagine like a box to store one thing (data)<br />Eg: int age;<br /> age = 5;<br />
  3. 3. Variable<br />Variable: imagine like a box to store one thing (data)<br />Eg: int age;<br /> age = 5;<br />int - Size of variable must be big enough to store Integer<br />
  4. 4. Variable<br />Variable: imagine like a box to store one thing (data)<br />Eg: int age;<br /> age = 5;<br />int - Size of variable must be big enough to store Integer<br />age - Name of variable<br />age<br />
  5. 5. Variable<br />Variable: imagine like a box to store one thing (data)<br />Eg: int age;<br /> age = 5;<br />5<br />int - Size of variable must be big enough to store Integer<br />age - Name of variable<br />age<br />age = 5 – Put a data 5 into the variable<br />
  6. 6. Value Type Vs Reference Type<br />Variables: two types<br />Value type (simple type like what you just saw)<br />Only need to store one thing (5, 3.5, true/false, ‘C’ and “string”)<br />Reference type (complex type for objects)<br />Need to store more than one thing (age + height + run() + … )<br />
  7. 7. Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br /> john = new Human();<br />Compare this to <br />int age;<br />age = 5;<br />
  8. 8. Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br /> john = new Human();<br />Human - Size of variable must be big enough to store an Address<br />
  9. 9. john<br />Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br /> john = new Human();<br />Human - Size of variable must be big enough to store an Address<br />john - Name of variable<br />
  10. 10. Reference Type<br />Reference type (complex type for objects)<br />Eg: Human john;<br /> john = new Human();<br />D403<br />age<br />…<br />Human - Size of variable must be big enough to store an Address<br />height<br />john - Name of variable<br />john<br />john = new Human() – Get a house with enough space for john (age, height, etc)<br />
  11. 11. Non-Static Vs Static Class<br />Non-Static: need New() to instantiate / create an object – like what you see just now<br />Static: no need to use New() to use, there is just one copy of the class. This type of class basically to provide special functions for other objects <br />So if you see a class being used without New(): it is a static class<br />EgMath class<br /> age = Math.Round(18.5); // Math rounding<br />
  12. 12. Using Console Program for problem solving<br />Console program:<br />Simple<br />Procedural (from top to bottom)<br />Getting inputs: <br />From arguments: How? <br />From keyboard: How?<br />Exercise 2.1 – 2.5<br />Language fundamental: int, double, string, Console.WriteLine(), Console.Write(), Console.ReadLine(), int.Parse(), double.Parse(), simple if then statement<br />Problem solving: repeating, swopping of 2 variables, simple sorting<br />

×