Download Issues in ATM Network Control - Washington University in

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CSE 131 Computer Science 1
Module 1: (basics of Java)
Welcome to CSE 131
Professor: Yixin Chen
Head TA: Sam Donohue
URL: http://classes.engineering.wustl.edu/cse131/
Discussion forum:
https://piazza.com/wustl/spring2015/cse131501n/home
All emails: cse131wustl@gmail.com
‹#›
Logistics
 Structure
of the course
» Lecture, studios, labs, exams
 Feel
free to ask questions
» We move pretty fast (learn it while you are here)
» Getting help: office hours, recitations, tutoring
 Expect
to spend lots of time programming
» Practice makes perfect
 Zero
tolerance on cheating!!
 Reading assignment before each lecture
» It’s for your best interest to finish it
‹#›
CS: Automation of processes
 CS
is about automation of computation and processes
 Computers
and computer software are everywhere
» laptops, cell phones, game systems, music players, televisions,
networks, cars, medical devices, appliances
‹#›
How Do Computers Work?
‹#›
A Little About Computers
very simple
 Memory is storage of data: an array of
numbered storage locations
» each location can store a numeric value
» each location identified by its address
Program
Memory
0
1
2
3
4
...
 Conceptually
Processor
 Processor
is a device that carries out simple machine
instructions
M[2] <=
M[2] <=
if M[3]
M[M[1]]
M[3]
M[3] + M[4] (also, -, *, /,...)
> M[0] then skip ahead 3 (or “go back 5”)
<= M[2] + M[M[4]] (one location “refers” to another)
 Modern
processor can carry out >109 instructions/sec
 So what is programming? – composing instructions to
do a certain task
‹#›
Programming Languages
‹#›
The Java Programming Language
• Developed by Sun in
1991 for a Green
Project for refrigerators
• The project failed, but
Java thrived
• Today, 1.1 Billion
devices are running
java
‹#›
Welcome to the World of Java
‹#›
Eclipse
 Integrated
Development Environment (IDE)
» “smart” editing of Java programs – continuous syntax checks
» compiles program files automatically as necessary
» integrated program testing and debugging tools
» has plug-ins for version control system (Subversion)
 Can
be a powerful tool for managing large projects
» but, can also be a bit overwhelming and mysterious at first
» watch the first few Eclipse videos on the web site before lab
 works
the same way in Windows, Mac and Linux
‹#›
Your First Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
» defines a class called HelloWorld (a class defines an object)
» class contains a single method called main
• in Java, the main method is the starting point of a program
• the main method has an array of arguments (not used here)
• Any program has one and only one main() method
» program “prints” a brief message and halts
‹#›
Today: understand basic building blocks
of JAVA
 You
will be able to
» Output a slogan on the screen
» Tell if a year is a Leap Year
» Calculate the area of a circle
» Output anything you like
» Do all kinds of calculation
‹#›
Basic unit: variable
A
variable in Java is a piece of
information stored in a computer’s
memory: like a jar holding food
 Each variable has a type
» Like different kinds of jars (different
food, size, usage, etc.)
 Main
types:
int a;
double b;
String s;
boolean x;
‹#›
Basic Data Types in Java
Type (keyword)
Meaning
Examples
Primitive
Operators
int
Integer
3, 0, -5, 256
+, -, *, /
double
Decimal number
1.5, -3.1415, 0.0
+, -, *, /
boolean
true or false
true, false
&&, ||, !
(return boolean:
<,>,<=,>=,!=,
==)
String
a sequence of
characters
“hello world”
+ (concatenation)
‹#›
Basic Definitions
type
Type.
A category of values and a set of operations on such values.
Variable. A name that refers to a value of a declared type.
Assignment statement. Associates a value with a variable.
‹#›
The int type
‹#›
Integers
This surprises most
students. Don’t feel
bad: experts forget
this too sometimes.
‹#›