intel ultimate engineering experience. introductions
TRANSCRIPT
INTE
L ULT
IMAT
E
EN
GI N
EE
RI N
G E
XP
ER
I EN
CE
INTR
ODUCTIONS
INSTRUCTORS
B R A D N I C H O L S
M I C H A E L K A T I C
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!• Variables, Variable Types
Monday
• Roll Playing Game• Loops, Conditionals, and Functions• Classes and Objects• Random class
Tuesday
• Creating a Tip Calculator• String Manipulation• Graphics• Drawing to a Window
Wednesday
• Build your own application or gameThursday• Build your own application or gameFriday
COURSE SCHEDULE
HELLO W
ORLD
TI M
E T
O G
ET
ST A
RT
ED
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
PROGRAMMIN
G BASIC
S
//COMMENTING YOUR CODE
When 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 at a note to whomever reads the code.
TYPES AND VARIABLES
int
1
-5
double
.999
15.1
String
“Hello”
“ “
bool
true
false
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
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.
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
CONDITIONALS
< less than > greater than <= less than or equal to >= greater than or equal to == equal to != not equal to && logical “and” (True only if both sides are true. False otherwise.) || logical “or” (False only if both sides are false. True otherwise.)
Example:if( X > 3 && X < 6 )if( hitPoints == fullHitPoints )
LEARNING CONDITIONALS
The "if" Statement
static void Main(String[] args)
{
int x;
x=20;
if (x > 0)
{
x -= 1;
Console.WriteLine(x);
}
}
IF ELSE VS. SWITCH STATEMENTS
I F E L S E S T A T E M E N T
if(number ==1){
// Print 1}else if( number ==2){
// Print 2}else{
// Print number}
S W I T C H S T A T E M E N T
switch(number){
case 1:{ // Print 1}break;
case 2:{ // Print 2}break;
default:{ // Print
number}break;
}
LEARNING LOOPS
The 'While' Loop
while (count < maxCount)
{
Console.WriteLine(count);
count++;
}
Console.ReadLine();
METHODS/F
UNCTIONS
DECLARING A METHOD
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 Method
bool f(int x)
{
//Do some stuff in here. Don’t 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.
More on Methods
METHOD EXAMPLE
The 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 METHOD
Now 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/O
BJECTS
CLASSES
A N I M A L . C S
Animal
name
age
weight
M A I N ( )
Animal myAnimal = new Animal();
Console.WriteLine(myAnimal.name);
Console.WriteLine(myAnimal.weight + “ Pounds”);
myAnimal.Eat();
Console.WriteLine(myAnimal.weight + “ Pounds”);
Ryan
10
125
CONSOLE WINDOWRyan125 Pounds126 Pounds
weight++; Eat()
Note: “weight++” is equivalent to “weight = weight + 1”
Dog breed
Animal
name
age
weight
INHERITANCED O G . C S
M A I N ( )
Dog myDog = new Dog();
Console.WriteLine(myDog.breed);
myDog.breed = “Dalmation”
Console.WriteLine(myDog.breed);
Console.WriteLine(myDog.age);
CONSOLE WINDOWPugDalmation10
Pug
Ryan
10
125
weight++; Eat()
RANDOM NUMBER GENERATOR CLASS
- Based off of “seeds”- Only 1 needed per Program- Used to create sudo-random content
- Random rand = new Random();
- Int number =rand.Next(min,max);
RESEARCHING YOUR ISSUES
Google 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 TOMORROW
Tomorrow 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
INTE
L ULT
IMAT
E
EN
GI N
EE
RI N
G E
XP
ER
I EN
CE