Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Java Packages CSci 1130 Intro to Computer Programming with Java Instructor Tatyana Volk.
In Review JAVA C++ GUIs - Windows Webopedia.com.
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Object Orientated Programming
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
1 Chapter 3 Programs and Packages. 2 Java Virtual Machine (JVM) Java programs execute on the JVM. The JVM is a virtual rather than a physical machine,
PHY281Introduction to JavaSlide 1 Introduction to Java In this section we will learn how how to use Java and write our first Java Applet:  The Java Development.
CS0007: Introduction to Computer Programming Setting Up Java.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
CMSC 202 Computer Science II for Majors Fall 2009 Introduction.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 1
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Introduction to Java Tonga Institute of Higher Education.
Introducing Java.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Chapter 1 Coding Introduction.
CS413: Java Programming language Applications Applets
M1G Introduction to Programming 2 4. Enhancing a class:Room.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Chapter 1: Creating Java Programs
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
CSE 1340 Class 3. Class 03 objectives State the difference between Machine Language vs. High Level Languages Discuss some characteristics of the Java.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
POS 406 Java Technology And Beginning Java Code
The Joy of Programming (also known as) Introduction to Object-Oriented Programming.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Creating a Java Application and Applet
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Computer Programming Week 1: The Basics of CP 1 st semester 2012 School of Information Technology Website:
Introduction to JAVA Programming
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Java Programming, 3e Concepts and Techniques Chapter 1 Section 56 – An Introduction to Java.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction CMSC 202 Fall Instructors Mr. Ryan Bergeron – Lecture Section 01 Tues/Thu 1:00 – 2:15 am, Sondheim 111 – Lecture Section 04 Tues/Thu.
Chapter 1 Coding Introduction.
GC101 Introduction to computer and program
CSCI-235 Micro-Computer Applications
Key Ideas from day 1 slides
Running Programs & IDEs Reference: COS240 Syllabus
Introduction to.
Chapter 2 First Java Programs
Java programming lecture one
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Coding Introduction.
(Computer fundamental Lab)
Computer Programming-1 CSC 111
Review of Previous Lesson
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Introduction to Algorithm

What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output An algorithm is thus a sequence of computational steps that transform the input into the output We can also view an algorithm as a tool for solving a well-specified computational problem.

How it represented? Description in natural language (Bahasa, English, any human language) Visualization (flow chart, flow diagram, etc) Pseudo code (Algorithmic notation)

Example Sorting algorithm: one might need to sort a sequence of numbers into nondecreasing order. –For example, given the input sequence 31, 41, 59, 26, 41, 58 –a sorting algorithm returns as output the sequence 26, 31, 41, 41, 58, 59 find the largest number in an (unsorted) list of numbers

Solution Algorithm LargestNumber Input: A non-empty list of numbers L. Output: The largest number in the list L. largest ← L0 for each item in the list L≥1, do if the item > largest, then largest ← the item return largest

Introduction to Java

What is Java The Java programming language is a high-level object- oriented language which was developed by Sun Microsystems. Like other object oriented languages, Java programs use classes and objects Java is more than simply a programming language. It is a cross platform software environment, which means that the same program can run on many different combinations of processor and operating system, without being recompiled for each platform. A Java source file is compiled to an intermediate language called bytecode. Bytecode is interpreted by a piece of software called a Java Virtual Machine (JVM), which translates it into the machine code for the system it runs on. The bytecode is exactly the same for all system. Java source files have a.java extension. Bytecode (compiled) files have a.class extension.

The Java Platform The Java platform consists of the following: –The JVM –The Java Application Programming Interface (API). The JVM provides the environment on which Java programs can run. The API provides a large collection of software components, or classes, which the programmer can include in programs. These provide a wide range of capabilities, e.g. user interface components, networking components, and many more. These components are organised in packages. The Java Runtime Environment (JRE) : This provides the JVM and the core Java classes. If you want to simply run existing Java programs on a system, then it is sufficient to have a JRE installed on the system. The Java Software Development Kit (JDK or Java SDK): This includes the JRE, together with compilers and debuggers and other development tools. If you want to develop Java programs, a JDK must be installed on your system.

Types of Java project Applications An application is a standalone program which runs on a JVM. It can produce text output to a command console, or it can have a graphical interface similar to a Visual Basic application. Graphical Java applications use the user interface components provided by the JVM, and look the same on any platform. Applets An applet is a program designed to run inside a web browser. A web page will have an area set aside to display the output from an applet, and the applet is downloaded over the web and runs in the browser. The output is usually graphical, and can use some of the same user interface components as an application. Web Applications A web application is a program which runs on a web server. Java web applications use technologies called servlets and Java Server Pages (JSP). Web applications are often used in web sites which interact with databases.

Java Development Tools The only software which is actually needed to write, compile and run Java programs is a JDK and a text editor. Current versions of the JDK (and JRE) are available free from Sun, and can be downloaded from their web site. Previous versions can also be downloaded. A source file can be created using the text editor and saved as a.java file. The JDK provides a compiler which can be run from a command line prompt to create a.class file. The.class file can then be executed from the command prompt. Productivity can be improved greatly by using an Integrated Development Environment (IDE), similar to the Visual Basic environment. Commonly used IDEs include NetBeans, Eclipse and Borland JBuilder. In this Kuliyah we will use BlueJ, an IDE which has been specifically designed for learning Java.

What is BlueJ BlueJ is a Java integrated development environment (IDE) which has been designed specifically for learning object oriented programming in Java It is more convenient to use than the standard Java command line tools, and easier to learn than a full- featured IDE such as NetBeans or Eclipse. It will also help you understand how the classes in your object oriented programs are related to each other

Java class features Comments Text between /* and */ symbols are comments to make the code easier to understand, and are ignored by the Java compiler. Comments can also be used to generate documentation automatically for your programs. Get into the habit of writing comments in this form at the top of all your programs. Comments can also be on a single line with // at the start. Classes A class starts with a declaration: public class HelloWorld and all the code is inside a pair of curly brackets { … } A more complicated program can have more than one class. Every program must have at least one class. Methods Methods are the actions that a class can perform. A class needs at least one method before it can actually do anything.

Java class features (2) Statements A statement is a single instruction. In Java, each statement must be ended with a semicolon (;) Variables A variable is a name which identifies a piece of data used by the program. The example contains two variables which contains a string of characters. String greeting = "How are you today?”; (String yourName) The variable yourName is created as a parameter of the sayHello method. Console output Applications can output results to the terminal window, or console, using System.out.println statements. These can output specified characters or the value of variables.