Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu https://xliu12.mysite.syr.edu/

Slides:



Advertisements
Similar presentations
User-Defined Functions Like short programs Can operate on their own data Can receive data from callers and return data to callers.
Advertisements

How to install “bubble” fonts These fonts are used to create the Formative Assessment sheets.
The Line Class Suppose you are involved in the development of a large mathematical application, and this application needs an object to represent a Line.
Copyright 2010 by Pearson Education Building Java Programs Chapter 7 Lecture 7-2: Arrays as Parameters reading: , 3.3 self-checks: Ch. 7 #5, 8,
Object Oriented Programming: Classes and Objects.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Lecture 05 - Arrays. Introduction useful and powerful aggregate data structure Arrays allow us to store arbitrary sized sequences of primitive values.
1 11/05/07CS150 Introduction to Computer Science 1 Functions Chapter 6, page 303.
COMP 110 Introduction to Programming Mr. Joshua Stough October 8, 2007.
Computer Science 1620 Multi-Dimensional Arrays. we used arrays to store a set of data of the same type e.g. store the assignment grades for a particular.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
AP Computer Science.  Not necessary but good programming practice in Java  When you override a super class method notation.
Scanner class for input Instantiate a new scanner object Scanner in = new Scanner(System.in); Getting input using scanner – int i = scanner.nextInt() –
1 11/8/06CS150 Introduction to Computer Science 1 More Functions! page 343 November 8, 2006.
CS 106 Introduction to Computer Science I 03 / 17 / 2008 Instructor: Michael Eckmann.
 Video and Audio Files can be played online just by selecting them  Video are flash files and will not work with Quicktime (Apple) or Windows Media.
S517 Web Programming Assistant Professor Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
CS 106 Introduction to Computer Science I 03 / 19 / 2007 Instructor: Michael Eckmann.
Problem Solving using the Java Programming Language May 2010 Mok Heng Ngee Day 5: Arrays.
BUILDING JAVA PROGRAMS CHAPTER 7 Arrays. Exam #2: Chapters 1-6 Thursday Dec. 4th.
Java Classes. Consider this simplistic class public class ProjInfo {ProjInfo() {System.out.println("This program computes factorial of number"); System.out.println("passed.
CS 112 Introduction to Programming Arrays; Loop Patterns (break) Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone:
Types in Java 8 Primitive Types –byte, short, int, long –float, double –boolean –Char Also some Object types: e.g. “String” But only single items. What.
Copyright © 2014 by John Wiley & Sons. All rights reserved.1 Chapter 10 - Interfaces.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
Introduction to C Programming Lecture 6. Functions – Call by value – Call by reference Arrays Today's Lecture Includes.
Week 11 - Friday.  What did we talk about last time?  Object methods  Accessors  Mutators  Constructors  Defining classes.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
Introduction to array: why use arrays ?. Motivational example Problem: Write a program that reads in and stores away 5 double numbers After reading in.
Coding Time This is a starter activity and should take about 10 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Start a script session (Select.
Dynamic Programming & Memoization. When to use? Problem has a recursive formulation Solutions are “ordered” –Earlier vs. later recursions.
Computer Science 112 Fundamentals of Programming II.
Control Flow Graphs : The if Statement 1 if (x < y) { y = 0; x = x + 1; } else { x = y; } x >= yx < y x = y y = 0 x = x + 1 if (x < y) { y = 0;
Algorithms JPC and JWD © 2002 McGraw-Hill, Inc. 2 Algorithms 2 An Algorithm is a finite set of precise instructions for performing a computation or for.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
 „BB FlashBack stores its movies in FlashBack (FBR) format. If you want non-FlashBack users to be able to watch your movie, you'll need to export it.
Tips: 1. To insert your picture, click “Insert” –> “Picture”, select picture from your computer. (or just click the icon in the middle of page.) You can.
Arrays and Sorting. Process Open a file that contains integers, one per line. Read each line, convert to short and store each into an array Sort the array.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
An Introduction to Programming with Alice Text and Sound in Alice Worlds.
Introduction to java (class and object). Programming languages: –Easier to understand than CPU instructions –Needs to be translated for the CPU to understand.
Some Assignments  Write a program which prints the following information about at least 5 persons: NAME MAIL-ID EMPLOYEE-CODE PHONE Eg. Umesh
Passing Objects to Methods
Java for Beginners Level 6 University Greenwich Computing At School
Java Course Review.
2.2 Defining Classes Part 2 academy.zariba.com.
Counted Loops.
Register Use Policy Conventions
Java Programming with BlueJ
Introduction to Application Programming
Pass by Reference, const, readonly, struct
CSC 113: Computer programming II
Implementing Classes Chapter 3.
Arrays .
CS2011 Introduction to Programming I Arrays (II)
Arrays ICS2O.
Building Java Programs
Which best describes the relationship between classes and objects?
Review for Test1.
Suggested self-checks: Section 7.11 #1-11
Dr. Sampath Jayarathna Cal Poly Pomona
Building Java Programs
How to insert the Ringtone Nightmare video clip (
Presentation transcript:

Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu

Design a method to compute the tips for a bill: Two parameters: 1.Subtotal (double) 2.Service quality (String, “good”, “OK” or “Bad”) The method returns the tips number: For “good” service – 20% For “OK” service – 15% For “Bad” service – 10%

There is a file “phonenumber.txt” saved a list of phone numbers. Give a number (read from jTextField1). If this number exists in the number list print “Exist!” in jLabel1; else print “Not exist!”

int [ ] numbers = {8, 3, 2, 5}; int sum = 0; for (int index = 0; index < numbers.length; index++) { if (sum < 10) { if (sum < 10) { sum = sum + numbers[index]; sum = sum + numbers[index]; }}System.out.println(sum);

Design a class to describe a video (should have properties like video length; video format, e.g. wmv, mpeg, flash; resolution of video, e.g X 768 or 640 X 480), while your class should have a constructor function with another two methods: getVideoFormat and getVideoLength.

Design a class to describe a video player. The properties including video player name; video player support OS (like windows or Mac); and the video playing right now (type: video class). With a constructor and a method: getVideoPlayerName.

Given two double type variables: number1 and number2 If number1 is larger than number2; swap the values of these variables.

Write the following numbers to a file “numbers.txt” 2,4,6,8,10,…,1000

int [] numbers = new int [50]; int [] numbers = new int [50]; for (int index = 0; index <= 50; index ++) { for (int index = 0; index <= 50; index ++) { numbers [index] = index * 2; numbers [index] = index * 2; } System.out.println(numbers[15]); System.out.println(numbers[15]); What is the result???

String names [] = new String [1000]; for (int index = 0; index < 1000; index ++) { for (int index = 0; index < 1000; index ++) { if (nameMatch(names[index], "Alice")) { if (nameMatch(names[index], "Alice")) { System.out.println(names[index]); System.out.println(names[index]); } } Write the code to implement nameMatch(String……, String……)

50 numbers saved in numbers[49] Print all the numbers larger than average