Study Guides (380,000)
CA (150,000)
Ryerson (10,000)
ITM (400)
Midterm

ITM 200 Study Guide - Midterm Guide: Dialog Box, Boolean Expression, Infinite Loop


Department
Information Technology Management
Course Code
ITM 200
Professor
Vikraman Baskaran
Study Guide
Midterm

This preview shows pages 1-3. to view the full 16 pages of the document.
Chapter 1
Solving Problems with Computers
-Java is one of the most popular programming languages in the world
-it is very popular because it can be used to solve a wide variety of problems in different domains
-Java is a great way to solve problems
Computers and Programming:
What is a Computer?
-a computer is a general purpose device that behaves according to the sets of instructions and data
-computers execute instructions to process data
-each computer has its core which is called Central Processing Unit (CPU)
These days CPU’s are built with a single microprocessor chip
Each microprocessor is associated with a set of instructions (machine codes) which it
can execute
Instructions and the data are stored as a binary bit pattern which is a string of 1’s and
0’s
-any computer can execute instructions in the machine code language of its microprocessor
What is a Computer Programmer?
1) Machine Language:
-set of primitive instructions
-every computer is associated with a set of “machine code” instructions that is designed to recognize
and execute
-machine code consists of a sequence of instructions
Example: two add two numbers you might write an instruction in binary code like this:
10010100100100101001001010 etc.
-all information is stored in the sequence of ones and zeros (binary bit pattern)
-it is highly to read and modify
-program can be stored on a disk
In order to execute the programs, it is loaded from the disk into the computer’s internal
memory; then the instructions are fetched one by one by the CPU and executed
2) Assembler Language:
-in order to overcome program of writing programs using binary bit language, assembler language was
developed to make a programming easy for humans to read, and programming less error prone
-computers cannot understand assembly language
-data can be represented using decimal numbers instead of binary
Example: Instruction to load the number 5 into a CPU might look like:
LD 5 instead of 0010010001001101
-assembler is used to convert assembly language programs into machine code
Example: to add two numbers, you might write an instruction in assembly code like this:
ADDF3 R1, R2, R3
3) High Level Languages and Compliers:
-high level languages are more abstract, problem oriented instructions that captured common patterns
of instruction usage found in assembler language

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

this meant that a single instruction from a 3rd generation language might be correspond to
several assembler language instructions, so that programs became shorter and more succinct
-programming languages became more oriented towards solving problems and less towards machine
architecture
-3rd generation language operated at a higher level of abstraction than the assembler program
-Example of 3rd generation language:
1980s: MODULA-2 C++
1990s: MODULA - 3 JAVA
-it is English like
-easy to learn and program
Example: following is a high-level language statement that computes the area of a circle with
radius 5:
area = 5 * 5 * 3.1415;
-in this class we will use “Java”
java is a relatively new programming language developed by Sun Microsystems, Inc
java has a built in graphical user interface support
it is intended to be platform independent
its syntax (structure) is similar to C++ but is simpler than C++
in high level language things like text, windows, buttons and files have a meaning, in machine
code only numbers have meanings
Compiling Source Code:
-program in high level language is called source code
-computers cannot understand a source program
-complier translates the source program
-linked with supporting library code
Constructing and Running Java Programs:
-java program is just a text file; it contains letters, numbers and symbols, it is often called a “source code
file”
-you can create the source code using any text editor, commercial java development packages normally
have an editor built it, if you are using Windows then the notepad program makes it perfectly to use
-you can use JCreator, the java complier will require the filename of the Java source file to end in “.java
-program text is then fed into the Java complier, it there are no errors in the program then the output
will be the file containing the complied byte code program, ready to run
-name of the file should be the same as the source code file but with the extension “.class”, if there are
no errors the complier will tell you what they are and will try to tell you where you are
depending on how well you have written the program, it may work or not
-process of finding out why a program does not work or does not work as expected is called “debugging”
-before you run your program you must compile them
complier: translates computer written in language to another language
java development kit: includes java complier
byte code: java complier converts your source code into a format named byte code that can be
executed on many different kinds of computers

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

Comments:
-any text following “//” on a line is a comment which is an explanation of what the program does
-there are 3 types of comments in Java
1. Line Comment: two slashes (//) in a line
2. Paragraph Comment: enclosed between /* and */ in one or multiple lines
3. Javadoc Comment: begins with /** and ends with */. Used for documenting classes, data, and
methods, can also be extracted into an HTML file using JDK’s javadoc command
Reserved Words:
-reserved words or keywords
-have a specific meaning to the complier
Example: when complier sees the word class it understands that the word after class is the
name for the class
-reserved words are; public, static, void
Blocks:
-pair of braces in a program that forms a block which groups components of a program
Classes:
-fundamental unit of organization in an object oriented program is the “class” which structures and
organizes a program
-classes are self contained and autonomous
-class must have the same name as the program file itself
-class should have an method called main (); this is where the program starts
-all program instructions must be inside methods, which are inside classes
-Common misunderstanding is that a program starts at the top, and continues downwards, however
Main Method:
Java programs start by executing the method called main ()
After this execution is controlled by the programmer
-Main method provides control of the program flow
-Java interpreter executes the application by invoking the main method
SUMMARY:
-java is an object oriented programming language
-java complier converts java program into Byte code
-when compilation is successful, Byte code can be successful
-java compilation contains many components like reserved words such as methods, comments etc
-java execution starts from the main method
public class Test {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Class block
Method block
You're Reading a Preview

Unlock to view full version