Upload
keefer
View
35
Download
0
Embed Size (px)
DESCRIPTION
Intel Ultimate. Engineering Experience. Introductions. Come on in, the code is GREAT!. Instructors. I sure do love making mobile apps!. Brad Nichols. Michael Katic. [email protected]. [email protected]. Ryan Scott. Come try on your computer science hats!. [email protected]. - PowerPoint PPT Presentation
Citation preview
INTEL ULTI
MATE
E N G I NE E R I N
G EX P E R I E
N C E
INTRODUCTIO
NS
INSTRUCTORS
B R A D N I C H O L S
M I C H A E L K A T I [email protected]
R Y A N S C O T T
Feel free to contact any of us for whatever reason If you cant figure out an error or are stuck on a design issue just shoot an email to one of our email and we’ll help out the best we can!
I sure do love
making mobile apps!
Come on in, the code is GREAT!
Come try on your
computer science hats!
WHO SPEAKS COMPUTER?
Join us on Facebook
And Wikispaces!
Computer Programming is the:• Designing• Writing• Testing• Debugging• and Maintaining of source code of computer
programs.
WHAT IS PROGRAMMING?
PayStarting Salaries in computer programming range from $59,000 to $112,000 per yearContract jobs run as high as $100 to $400 per hour
Flexibility & IndependenceWork from home as freelance contractorNearly always able to work from homeBring your work anywhereThe “Do good work and we wont ask questions” policy
Demand & Job SecurityAs long as society relies on computing technology, there will be a demand for computer programmers.
WHY DO I WANT TO BE A COMPUTER PROGRAMMER?
Notes from: http://www.indeed.com/
http://www.askitcareercoach.com/ http://smallbusiness.chron.com/advantages-being-computer-programmer-38637.html
•While (Students.Understand() == false)Students.teachProgramming();
•Hello, World!•Commenting, Types, Variables, OperatorsMonday•Roll Playing Game•Loops, Conditionals, and Functions•Classes and Objects•Random classTuesday•GraphicsWednesday• Build your own application or gameThursday• Build your own application or gameFriday
COURSE SCHEDULE
HELLO W
ORLD
T I ME T
O GE T S
T A R T E D
HELLO, WORLD!class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); } }
TIP:Don’t forget to add
Console.ReadKey(true);to stop the console window from closing.
Hello World TutorialGeneral Structure of a C# Program
Main() and Command-Line Arguments
PROGRAMMING BASICS
//COMMENTING YOUR CODEWhen your programming you may want to leave behind notes.
To do this we use double backslashes at the beginning of the line we wish to put notes on.
For example: //Print out text to the screen.Console.WriteLine("Hello, World!");The line above in green will be ignored and acts as a note
to whomever reads the code.
TYPES AND VARIABLES
int
1
-5
Declaration of a Variableint x;
The line above creates a new variable named “x” of type int
Initialization of a Variablex = 5;
This line set our variable “x” to the value 5
Accessing a Variableint z = x;
This accesses the value assigned to variable “x” and assigns it to the value of the variable “z”
More on Types
OPERATORS More on Operators
int x = 5; int y = 6; Console.WriteLine(x + y);
String x = 5; String y = 6; Console.WriteLine(x + y);
11 56
We can use symbols in c# like “+, -, *, /” to perform operations.
int x = 5 + 1; //This sets x to 6 int y = x + 1; //Sets y to 7
Knowing the type of the variable allows our operations to behave differently based on the type. For example observe the two different outputs below.
CONDITIONAL OPERATORS < less than > greater than <= less than or equal to >= greater than or equal
to
== equal to != not equal to && logical and || logical or
a b a > b
a <= b
1 2 F T1 1 F T2 1 T F2 2 F T
a b a == b
a != b a && b
a || b
T T T F T TT F F T F TF T F T F TF F T F F F
Examples
CONDITIONAL STATEMENTS (IF ELSE)bool result = true; //What happens when you change true to false.
if (result) { Console.WriteLine("The variable is set to true."); } else { Console.WriteLine("The variable is set to false."); }
More on if else
IF ELSE VS. SWITCH STATEMENTSI F E L S E S T A T E M E N T S W I T C H S T A T E M E N T
if (number == 1){ // Print 1 } else if (number == 2){ // Print 2 } else { // Print number }
switch(number) { case 1: // Print 1 break; case 2: // Print 2 break; default: // Print number break; }
More on switch
LEARNING LOOPSint n = 1;
while (n < 6) { Console.WriteLine("Current value of n is " + n); n++; }
Current value of n is 1Current value of n is 2Current value of n is 3Current value of n is 4Current value of n is 5
More on while loop
METHODS/FU
NCTIONS
DECLARING A METHODMore on Methods
Just like we have functions in math we have methods in C#. And just like in math our functions have some input and some output. (see example below of how to create a method)
Declaration of a Methodbool f(int x) { //Do some stuff in here. Dont forget to return a bool. }
The lines above create a new function named “f” that takes an input “x” of type int and returns a bool value.
METHOD EXAMPLEThe method below returns true when it is given an input of “0” otherwise it returns false.
bool isZero(int val) { if (val == 0) { return true; } else { return false; } }
CALLING A METHODNow if I want to use my new method to check if a value is zero I can do that like this:
int x = 0; int y = 5; bool xCheck; bool yCheck;
xCheck = isZero(x); //xCheck is now set to true yCheck = isZero(y); //yCheck is now set to false
CLASSES/OBJECTS
Animal
name
age
weight
Ryan
10
125
weight++; Eat()
CLASSESA N I M A L . C S
M A I N ( )
Note: “weight++” is equivalent to “weight = weight + 1”
Ryan125 Pounds126 Pounds
Animal myAnimal = new Animal();
Console.WriteLine(myAnimal.name); Console.WriteLine(myAnimal.weight
+ Pounds); myAnimal.Eat(); Console.WriteLine(myAnimal.weight
+ Pounds);
Dog breed
Animal
name
age
weight
INHERITANCED O G . C S
M A I N ( )Pug
Ryan
10
125
weight++; Eat()
PugDalmation10
Dog myDog = new Dog(); Console.WriteLine(myDog.breed); myDog.breed = Dalmation Console.WriteLine(myDog.breed); Console.WriteLine(myDog.age);
RANDOM (NUMBER GENERATOR) CLASSMore on Random.Next()
Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness.
Random numGen = new Random();
randNum = numGen.Next(0, 3); //Sets randNum to either 0, 1, or 2
More on Random Class
Inclusive Lower Bound
Exclusive Upper Bound
RESEARCHING YOUR ISSUESGoogle is your friend!Here are some other friends you might want to become
familiar with:• MSDN Learning Recources• Top C# Questions on Stack Overflow• Get More Out of Google
GETTING A JUMP START ON TOMORROWTomorrow we will be learning more about
the following:• Conditionals, Loops, and Methods• Classes• Random class
To get a head start you can visit the links above and play around with some of the code provided.HAPPY CODING
INTEL ULTI
MATE
E N G I NE E R I N
G EX P E R I E
N C E