Electronic Commerce Java (1)

Slides:



Advertisements
Similar presentations
In Review JAVA C++ GUIs - Windows Webopedia.com.
Advertisements

April 20023CSG11 Electronic Commerce Java (1) John Wordsworth Department of Computer Science The University of Reading Room 129,
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Introduction to Java Kiyeol Ryu Java Programming Language.
Created by Ron Beglieter (based on the Java Tutorial) 1 What is Java? Java technology is both a programming language and a platform; Programming Language.
CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
April 20023CSG11 Electronic Commerce Design (1) John Wordsworth Department of Computer Science The University of Reading Room.
Programming Languages and Paradigms Object-Oriented Programming.
Advanced Java New York University School of Continuing and Professional Studies.
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
Intro to Java 2 By Geb Thomas Based on the Java TutorialJava Tutorial.
CSE 1340 Class 3. Class 03 objectives State the difference between Machine Language vs. High Level Languages Discuss some characteristics of the Java.
FRST JAVA PROGRAM. Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications.
Introduction to Java and Object-Oriented Programming AJSS Computer Camp Department of Information Systems and Computer Science Ateneo de Manila University.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java Spring PImage Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
POS 406 Java Technology And Beginning Java Code
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
April 20023CSG1HTF 1 Electronic Commerce HTML forms John Wordsworth Department of Computer Science The University of Reading
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
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.
ACM/JETT Workshop - August 4-5, : Defining Classes in Java.
1 The JAVA Language Object Oriented Technology Mithani Binjan M.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
CS 178: Programming with Multimedia Objects Aditya P. Mathur Professor of Computer Sciences Purdue University, West Lafayette August 27, 2004 Last update:
Introduction to Java John Lewis. Course Overview Introduction Object Orientated Programming Java Structure and Syntax Using the Java Platform Advanced.
April 20023CSG11 Electronic Commerce Java (2) John Wordsworth Department of Computer Science The University of Reading Room 129,
April 20023CSG11 Electronic Commerce Transaction processing John Wordsworth Department of Computer Science The University of Reading
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Outline Anatomy of a Class Encapsulation Anatomy of a Method Graphical Objects Graphical User Interfaces Buttons and Text Fields Copyright © 2012 Pearson.
Java Spring PImage Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What.
April 20023CSG1DE2 1 Electronic Commerce Design (2) John Wordsworth Department of Computer Science The University of Reading Room.
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.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
CMSC 202 Computer Science II for Majors Fall 2010 Introduction Version 9/101.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
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.
Applications Active Web Documents Active Web Documents.
Dept of Computer Science University of Maryland College Park
Chapter No. : 1 Introduction to Java.
Introduction to Advanced Java Programming
Introduction to.
Internet and Java Foundations, Programming and Practice
Programming Language Concepts (CIS 635)
Introduction to Java.
Chapter 4: Writing classes
Object Oriented Programming
CS2011 Introduction to Programming I Objects and Classes
CS100J Lecture 7 Previous Lecture This Lecture Java Constructs
Introducing Java.
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Electronic Commerce Design (1)
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:

Electronic Commerce Java (1) John Wordsworth Department of Computer Science The University of Reading J.B.Wordsworth@rdg.ac.uk Room 129, Ext 6544 April 2002 3CSG1

Lecture objectives Outline the place of the Java language in E-commerce Revise the concepts of object-oriented programming Describe the structure of a Java class and its parts Describe the structure of a Java application, and the way it uses objects Explain how Java implements inheritance April 2002 3CSG1

What is Java An object-oriented programming language invented by Sun Microsystems A collection of classes that model useful objects: windows, buttons, text areas, files, databases … A language for developing applications that can be executed on many platforms: Write Java source code Compile to Java bytecodes (javac) Execute under the control of the Java Virtual Machine (java) April 2002 3CSG1

Java in e-commerce Client programming with applets: Classes for setting up and controlling the graphical user interface Server programming with servlets: Classes for managing the interface with tier 1 (JSPs) Classes for managing the interface with tier 3 (EJBs) April 2002 3CSG1

An object-oriented language Object - an instance of a class: variables methods Message - executing a method: destination object (class) parameters Class - a blueprint for objects: class variable (static) and class method (static) instance variable and instance method constructor inheritance Interface - a collection of methods April 2002 3CSG1

An interface for a simple bank account public interface AccountIf { void deposit (int amt); void withdraw (int amt); void showBal; } April 2002 3CSG1

A class for a simple bank account public class Account implements AccountIf { private String sortcode, acctno; private int balance; Account (String sc, String an) { sortcode = new String (sc); acctno = new String (an);balance = 0;} public void deposit (int amt) { balance = balance + amt; } public void withdraw (int amt) { balance = balance – amt;} public void showBal { System.out.println ( “Sort code “+sortcode+” Acct number “+acctno=“ Balance “+balance); } April 2002 3CSG1

A program to use a bank account public class AccountMain { public static void main (String [] args) { Account ac1 = new Account ("304050", "01234567"); ac1.showBal(); ac1.deposit(500); ac1.withdraw(575); } April 2002 3CSG1

A bit of inheritance public class DAccount extends Account { DAccount (String sc, String an, int opening) { super (sc, an); balance = opening;} public void withdraw (int amt) { if (amt < balance) { balance = balance - amt; } else { System.out.println ( "Withdrawal not allowed"); } } April 2002 3CSG1

A program to use a deposit account public class DAccountMain { public static void main (String [] args) { DAccount ac2 = new DAccount ("304050", "01234567“, 1000); ac1.showBal(); ac1.withdraw(500); } April 2002 3CSG1

Sample output Sort code 405060 Account number 98765432 Balance 1000 Withdrawal not allowed April 2002 3CSG1

Key points Java is an object-oriented language for writing portable applications. Java has classes that support the construction of programs to run in Tier 1 (applets) and Tier 2 (servlets) of an e-commerce system. Java classes have a regular structure that can be adapted to writing object-oriented applications, classes, and objects. April 2002 3CSG1