Download presentation
Presentation is loading. Please wait.
Published byBrian Fox Modified over 9 years ago
1
your brain and the machine ACO101: Introduction to Computer Science
2
Review: Flowcharts Are: – A schematic representation of a process – And a visual way to describe an algorithm
3
Review: Shapes used in flowcharts
4
Review: Terminators are oval
5
Review: Processes are rectangles
6
Why do flowcharts work as a planning strategy? http://www.ted.com/talks/lang/eng/tom_wuj ec_on_3_ways_the_brain_creates_meaning.h tml http://www.ted.com/talks/lang/eng/tom_wuj ec_on_3_ways_the_brain_creates_meaning.h tml
7
Ok so now you know how to make a plan You know Class Diagrams, Sequence Diagrams, Pseudocode and now you know Flowcharts – These are all planning tactics Next you need to get to know your machine. – Because that is where it [the program that you planned] is going.
8
This explains a machine pretty well http://videos.howstuffworks.com/howstuffwo rks/23-computer-tour-video.htm http://videos.howstuffworks.com/howstuffwo rks/23-computer-tour-video.htm – 3.25 min
9
RAM is very important to your programs because it is the Primary Storage
10
Random Access Memory
11
Understanding Your Computer‘s Memory What is your computer's RAM used for? It has several uses, but only data storage need concern you as a programmer. Data is the information with which your program works. Whether your program is maintaining a contact list, monitoring the stock market, keeping a budget, or tracking the price of snickerdoodles, – the information (names, stock prices, expense amounts, or prices) is kept within variables in your computer's RAM when it is being used by your running program.
12
RAM A computer uses random access memory (RAM) to store information while it is operating. RAM is located in integrated circuits, or chips, inside your computer. RAM is volatile, which means that it is erased and replaced with new information as often as needed. Being volatile also means that RAM "remembers" only while the computer is turned on and loses its information when you turn the computer off.
13
RAM continued File Storage Capacity by Bits and Bytes bitbyteKilobyteMegabyteGigabyte bit188,1928,388,608 8,589,934,59 2 byte811,0241,048,576 1,073,741,82 4 Kilobyte8,1921,0241 1,048,576 Megabyte8,388,6081,048,5761,0241 Gigabyte 8,589,934,59 2 1,073,741,82 4 1,048,5761,0241 Terabyte 8,796,093,02 2,208 1,099,511,62 7,776 1,073,741,82 4 1,048,5761,024 Petabyte 9,007,199,25 4,740,990 1,125,899,90 6,842,620 1,099,511,62 7,776 1,073,741,82 4 1,048,576 Exabyte 9,223,372,03 6,854,780,00 0 1,152,921,50 4,606,850,00 0 1,125,899,90 6,842,620 1,099,511,62 7,776 1,073,741,82 4 Zettabyte 9,444,732,96 5,739,290,00 0,000 1,180,591,62 0,717,410,00 0,000 1,152,921,50 4,606,850,00 0 1,125,899,90 6,842,620 1,099,511,62 7,776
14
We make Variables To store data in memory So far we have made reference variables [objects]
15
Remember this? “ Make a new variable and call it counter”
16
Review: a variable is something That we save for later In textbook speak: A variable is an instance of a type that can hold a value.
17
Variables A variable has a type and a name. String yourname = “Theresa”; The type is sometimes referred to as a datatype Variables come in 2 flavors: primitive and reference
18
String Is a reference type Made up of characters Series of characters treated as a single unit. This line of code initializes a String reference named greeting to refer to the anonymous String object “Hello Theresa” String greeting= “Hello Theresa”;
20
What if we want to use numbers?
21
These are the number primitive types
22
Object Identity Example Primitive data types don't have identity. You cannot distinguish two primitives when the values are same. primitive variables represent values not objects double x = 10; double y = 10; if ( x == y ) {System.out.println("same");} // true
23
Object Identity Example Objects do have identity. You can distinguish two objects even when the values are the same. object variable is a reference to an object Double x = new Double(10); Double y = new Double(10); if ( x == y ) {System.out.println("same");} // false
24
What if we have a piece of information that does not change? That is called a constant. This example is a nickel. Nickels are always 5 cents.
25
One really useful constant is PI public static final double PI = 3.14 (blah blah blah); Variables can be declared with the “static” keyword [we have also seen it on the main method in our tester class] When a variable is declared with the static keyword, its called a “class variable”. All instances share the same copy of the variable. A class variable can be accessed directly with the class, without the need to create a instance. Without the “static” keyword, it's called “instance variable”, and each instance of the class has its own copy of the variable.
26
For using PI in your code there is a Math object (more on objects later) double circumference = Math.PI * diameter Math.PI is a constant
27
Homework (these are on assignment sheets) Read – http://en.wikipedia.org/wiki/Flowchart http://en.wikipedia.org/wiki/Flowchart – More stuff in Big Java : do the wiley plus questions Watch – http://www.youtube.com/watch?v=-GQmtITMdas http://www.youtube.com/watch?v=-GQmtITMdas – http://www.youtube.com/watch?v=XtGf0HaW7x4 http://www.youtube.com/watch?v=XtGf0HaW7x4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.