Introduction to Mobile Application Architecture and ... - Google Sites

0 downloads 114 Views 505KB Size Report
M.S. Computer Science and Software Engineering – DePaul University, Chicago,. Illinois ... Windows Mobile and Android
CIS631 INTRODUCTION TO MOBILE APPLICATION ARCHITECTURE AND IMPLEMENTATION ON ANDROID

Sittisak Thananittayaudom and Dr. Suchai Thanawastien

About the Instructor Sittisak Thananittayudom • M.S. Computer Science and Software Engineering – DePaul University, Chicago,

Illinois • Senior Developer at Evention LLC, Chicago, Illinois • Certified Professional .NET Developer • Windows Mobile and Android developer Contact information: [email protected] - Please prefix your email subject with “CIS631:” - You can email me in Thai or English.

Java Application Development

*Image from http://www.passionspeaks.co.cc/2011/09/introduction-to-java.html

Java Application Development • •

Developers need JDK. End-users only need JRE

Examples of Java applications • http://www.vuze.com (Windows Application) • http://homepage.tinet.ie/~leslie/t estpage/speedtest.htm (Applet)

Console Application vs. GUI • Console Applications Flow of execution usually starts from top and proceeds until the last line of code.

Console Application vs. GUI • Console Applications

- How do we start a console application?

- When does a console application stop?

Console Application vs. GUI • GUI Applications Flow of execution depends on user actions.

Console Application vs. GUI • GUI Applications

- How do we start a GUI application?

- When does a GUI application stop?

Preparing the Development Environment

What we need… 1. A laptop computer running Windows XP or higher. Any Mac users here? 2. Java Platform (JDK) 32-Bit. The 32-Bit version is recommended even if your OS is 64-Bit.

Preparing the Development Environment http://www.oracle.com/technetwork/java/javase/downloads/index.html

Preparing the Development Environment http://www.oracle.com/technetwork/java/javase/downloads/index.html

Preparing the Development Environment What we need (continued) 3. TextPad (evaluation version) http://www.textpad.com/download/index.html#downloads

Preparing the Development Environment What we need (continued) 4. Configure TextPad for compiling and running Java applications

Your First Console Application

Your First Console Application

Watch out for Compiler Errors

The Java Programming Language Two Important Characteristics • Case Sensitive: For example, myNumber is not the same as MyNumber – more on this later.

• Insignificant whitespace: Use extra lines and spaces to make your code readable. Indent your code blocks properly to keep your code clean.

Comments It’s considered a good practice to insert comments as you write your code. It will help others understand your code easier and remind yourself of what you have done. There are two styles of comments – single-line (the // syntax) and multi-line (the /* */ syntax)

Common Data Types in Java - Data types you will use a lot in your everyday programming: – 5, 4000, 0, -12 • double – 10.25 • String – “Hello”, “How are you?”, “” • boolean – true / false • int

- There are a lot more data types in Java but we will discuss the common ones for now.

Variable Declarations - A variable name must begin with a letter (not a number) and should start with a lowercase letter.

- Giving a meaningful name to your variables will make your code easier to read.

Assignment Statements - Use assignment statements to give value to your variables.

- Variable declaration and the assignment statement can be combined into one line. For example, int x = 5;

Operators Common Operators in Java (more will be discussed later in this course) • (+) Addition • (-) Subtraction • (*) Multiplication • (/) Division

• (%) Modulus (or Mod in short)

Operator Precedence (which operator will be used first) • Higher precedence – (*), (/), and (%) • Lower precedence – (+) and (-)

Operators What is the output of this program?

Watch out for unintended integer division.

Operators What is the output of this program?

Sample Application Calculating VAT and Total

Sample Application Converting Fahrenheit to Celsius

Homework 1.

Get JDK and TextPad installed on your computer. Configure TextPad to compile and run Java applications.

2.

Create an application that converts 32.5°C to °F. This is simply the reverse of one of the sample applications. Name your file “CelsiusToFahrenheit.java”. The output of your application must look exactly like the one below:

Homework 3.

Let’s assume you get a 10% discount off your original total bill of 599.5 Baht. Create a program named “TenPercentDiscount.java” . The output of your program must look exactly like the one shown below:

Homework Submission Instructions •

Submit a zip file called Homework1.zip. The zip file should have only CelsiusToFahrenheit.java and TenPercentDiscount.java inside.



Email the zip file to [email protected]. The email subject should read “CIS631 - Homework1”. The deadline is at the beginning of the next class (9.00AM).

Suggest Documents