csce 145: algorithmic design i chapter 1 intro to computers and java muhammad nazmus sakib
TRANSCRIPT
![Page 1: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/1.jpg)
CSCE 145: Algorithmic Design IChapter 1Intro to Computers and Java
Muhammad Nazmus Sakib
![Page 2: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/2.jpg)
Computer Basics
•Section 1.1
![Page 3: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/3.jpg)
Computer Systems
•Hardware▫The Physical Machine
•Software▫Set of programs
Set of instructions
![Page 4: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/4.jpg)
Hardware and Memory
•Central Processing Unit (CPU)▫Also known as the Processor▫Device that performs the instructions in a
program▫Example
Intel Core i7
![Page 5: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/5.jpg)
Hardware and Memory
•Memory▫Holds data for the computer to process▫Two forms
Main Memory Volatile Example - RAM
Auxiliary Memory Non-volatile Example – Hard drive
![Page 6: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/6.jpg)
Bits, Bytes & Address•Bit = Binary Digit (0,1)•Byte = groups of bits
▫1 Byte = 8 Bits▫Byte is the smallest addressable unit of
memory•Address
▫Main memory consists of a long list of numbered bytes
▫The number of a byte in memory is called an Address
![Page 7: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/7.jpg)
Memory Locations
•1 byte is not large enough to store all kinds of data
•Data can be stored in several adjacent bytes
•These adjacent bytes are considered a single Memory Location
•Address of the Memory Location▫Address of the first byte
![Page 8: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/8.jpg)
Main Memory
![Page 9: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/9.jpg)
Files & Directories
•File▫A group of bytes stored in auxiliary
memory•Directory
▫Also known as Folder▫Contains groups of files
![Page 10: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/10.jpg)
Programs
•A set of instructions
![Page 11: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/11.jpg)
Operating Systems
•A program that supervises a computer’s operation
•Examples▫Windows XP/7/8▫UNIX▫Linux, Ubuntu▫Mac OS X
![Page 12: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/12.jpg)
Programming Languages
•High Level Languages▫Java, C, C++, C#, Visual Basic, Python
•Low Level Languages▫Assembly Language▫Machine Language
![Page 13: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/13.jpg)
Compilers
•A Translator•Translates from High Level Language to
Low Level Language•Source code -> Object Code•Compile Once, Execute Often
![Page 14: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/14.jpg)
Interpreters
•Translator + Executor•Alternates between translation &
execution•Translates every time•Interpreted programs are slower than
compiled ones
![Page 15: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/15.jpg)
Java Bytecode
•An intermediate language for Java•A compiler translated Java code into
Bytecode•Java Virtual Machine (JVM)
▫Translator to translate & execute Java Bytecode
•Bytecode runs in any computer that has JVM▫Portability
![Page 16: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/16.jpg)
Compiling & Running
![Page 17: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/17.jpg)
Class Loader
•Java program consists of Classes▫A piece of code▫Generally reside in one file
•Class loader connects the Classes▫Similar to a Linker
![Page 18: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/18.jpg)
A Sip of Java
•Section 1.2
![Page 19: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/19.jpg)
History of Java
•Started in 1991•James Gosling and his team
▫Sun Microsystems
![Page 20: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/20.jpg)
Applications & Applets
•Applications▫Regular programs▫Runs in your computer
•Applets▫Little applications▫Runs in your web browser▫Sent over the Internet
![Page 21: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/21.jpg)
Programming Basics
•Section 1.3
![Page 22: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/22.jpg)
Object-Oriented Programming
•Objects▫Attributes▫States▫Behaviors
•Methods▫Captures the behavior
•Classes▫Blueprint for Objects
![Page 23: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/23.jpg)
Object-Oriented Programming
•Encapsulation▫Information Hiding
•Polymorphism▫Many forms▫Example – “Go play your favorite sport”
•Inheritance▫Way of organizing Classes
![Page 24: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/24.jpg)
Inheritance
![Page 25: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/25.jpg)
Algorithms
•Like a Recipe!•A set of directions for solving a problem•Often written in Pseudocode
▫Combination of English & Programming Language
![Page 26: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/26.jpg)
Pseudocode Example
•Algorithm to compute the total cost of a list of items▫Write the number o on the whiteboard.▫For each item on the list
Add the cost of the item to the number on the whiteboard
Replace the number on the whiteboard with the result of this addition.
▫Announce that the answer is the number written on the whiteboard.
![Page 27: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/27.jpg)
Testing & Debugging
•Bug▫A mistake in a program
•Debugging▫Process of eliminating mistakes
•Syntax error▫Grammatical mistakes
•Run-time error▫Error during execution
•Logic error▫Conceptual mistakes in algorithm
![Page 28: CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib](https://reader031.vdocuments.us/reader031/viewer/2022032702/56649cab5503460f9496ce7e/html5/thumbnails/28.jpg)
Software Reuse
•Java Class Library▫Java API
•Example▫System.out.println