Java: Chapter 1 Computer Systems Computer Programming II.

Slides:



Advertisements
Similar presentations
Chapter 1: Computer Systems
Advertisements

Programming Languages
Programming with Java. Problem Solving The purpose of writing a program is to solve a problem The general steps in problem solving are: –Understand the.
1 Java Programming Basics SE-1011 Dr. Mark L. Hornick.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
1 Kursusform  13 uger med: Undervisning i klassen 1,5-2 timer Opgave ”regning” i databar (løsninger på hjemmeside) En midtvejsopgave der afleveres og.
The Java Programming Language
Outline Java program structure Basic program elements
Chapter 1 Introduction. © 2004 Pearson Addison-Wesley. All rights reserved1-2 Outline Computer Processing Hardware Components Networks The Java Programming.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Chapter 1 Introduction.
Copyright 2013 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Java: Chapter 1 Computer Systems Computer Programming II Aug
Prepared by Uzma Hashmi Instructor Information Uzma Hashmi Office: B# 7/ R# address: Group Addresses Post message:
Chapter 1 Programming Languages. Application Development: Top 10 Programming Languages to Keep You Employed 1. Java 2. C# 3. C++ 4. JavaScript 5. Visual.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley John Lewis, Peter DePasquale, and Joseph Chase Chapter 1: Introduction.
© 2006 Pearson Education Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition.
Java Language and SW Dev’t
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Chapter 1 Introduction 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
Introduction. Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2.
C Derived Languages C is the base upon which many build C++ conventions also influence others *SmallTalk is where most OOP comes Java and Javascript have.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Chapter 2: Java Fundamentals
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
1 Problem Solving b The purpose of writing a program is to solve a problem b The general steps in problem solving are: Understand the problemUnderstand.
White Space Spaces, blank lines, and tabs are collectively called white space and are used to separate words and symbols in a program Extra white space.
ZObject-Oriented Software Development yproblem solving yprogram design and implementation yobject-oriented concepts xobjects xclasses xinterfaces xinheritance.
Intro to Programming  Chapter 1 Part 2  Problem Solving.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Java.
Chapter 1 Introduction. 2 Focus of the Course Object-Oriented Software Development problem solving program design, implementation, and testing object-oriented.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Introduction to Java Programming by Laurie Murphy Revised 09/08/2016.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Working with Java.
Chapter 4 Assignment Statement
Chapter No. : 1 Introduction to Java.
Lecture 2: Data Types, Variables, Operators, and Expressions
Variables and Arithmetic Operators in JavaScript
1.3 Problem Solving The purpose of writing a program is to solve a problem The general steps in problem solving are: Understand the problem Dissect the.
null, true, and false are also reserved.
Introduction to Java Programming
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
An overview of Java, Data types and variables
Instructor: Alexander Stoytchev
Chapter 1: Computer Systems
Units with – James tedder
Units with – James tedder
JavaScript Reserved Words
Instructor: Alexander Stoytchev
Java Software Solutions Foundations of Program Design 9th Edition
Focus of the Course Object-Oriented Software Development
CSE 142, Spring 2012 Building Java Programs Chapter 1
Instructor: Alexander Stoytchev
Zorah Fung University of Washington, Spring 2015
Chap 2. Identifiers, Keywords, and Types
Agenda Types and identifiers Practice Assignment Keywords in Java
Zorah Fung University of Washington, Winter 2016
Presentation transcript:

Java: Chapter 1 Computer Systems Computer Programming II

Why Java? A good question before we even begin looking at the Java language. The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future of computing is being profoundly influenced by the Internet, and Java promises to remain a big part of that future.. F Java is a general purpose programming language. F Java is the Internet programming language.

What About Java? James Gosling and Sun Microsystems created and distributed Java Java was released on May 20, 1995 as a free program and has grown into one of the most popular programming languages in the world. Java can be downloaded along with the program(JCreator) we will use to work with Java from free. Instructions can be found on my school web page with links to the download sites.

Java a Problem Solver???? The purpose of writing a program is to solve a problem The general steps in problem solving are: –Understand the problem –Dissect the problem into manageable pieces –Design a solution –Consider alternatives to the solution and refine it –Implement the solution –Test the solution and fix any problems that exist –Example You walk out to your car insert the key into the ignition and nothing happens…Solve this problem using the above steps.

Problem Solving Many projects fail because the developer/repair person didn't really understand the problem to be solved.

Java Program Structure As a class lets create your first java program which in located on page 27 and is called the Lincoln program. To create the program follow the instructions within the word document that has illustrated instructions and hints for success.

Lets Create another program To practice our java programming skills lets use the Lincoln program as a model and create a program that displays that following… Name Address DOB Phone Number The program should be named Personal

Java vs. Visual Basic Create a program in visual basic that displays the same output as the Lincoln program that was just created in Java. Remember in VB you will use labels and a command button to make your program work correctly.

Java vs. Visual Basic What are some of the similarities between Java and Visual Basic? What are some of the differences between Java and Visual Basic?

10 Main Parts of a Java Program public class MyProgram {}{} // comments about the class class header class body Comments can be placed almost anywhere, comments are short descriptive statements About your program or lines of code.

11 Main Parts of a Java Program public class MyProgram {}{} public static void main (String[] args) {}{} // comments about the class // comments about the method method header method body Main Method

12 Comments Comments should be included to explain the purpose of the program and describe processing steps They do not affect how a program works Java comments can take three forms: // this comment runs to the end of the line /* this comment runs to the terminating symbol, even across line breaks */ /** this is a javadoc comment */

Assignment Using the Lincoln program on page 27 as an example design a program(You decide the name of the program) that produces your favorite quote as output and also tells who made the quote. Inside of your program insert comments that will identify the following sections within your program 1) Main Method 3) Class Header 4)Class Body 5) Method Header 6)Method Body Turn the printout of your code in for a 50 point grade. Make sure your name is included.

14 Identifiers Identifiers are the words a programmer uses in a program and can change from program to program and programmer to programmer. Java is case sensitive(uppercase and lowercase make words different) - Total, total, and TOTAL are 3 different identifiers. In Visual Basic they would all be the same identifier.

Identifiers Often we use special identifiers called reserved words that already have a predefined meaning in the language A reserved word cannot be used in any other way

16 Reserved Words The Java reserved words(as found on page 31 of the text): abstract boolean break byte case catch char class const continue default do double else extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient true try void volatile while

17 White Space Spaces, blank lines, and tabs are called white space White space is used to separate words and symbols in a program Extra white space is ignored A valid Java program can be formatted in many ways Programs should be formatted to enhance readability, using consistent indentation See Lincoln2.java (page 33)Lincoln2.java See Lincoln3.java (page 34)Lincoln3.java

Basic Program Development errors Edit and save program Compile program Execute program and evaluate results

Representing Color A black and white picture can be stored using one bit per pixel (0 = white and 1 = black) A colored picture requires more information; there are several techniques for representing colors For example, every color can be represented as a mixture of the three additive primary colors Red, Green, and Blue In Java, each color is represented by three numbers between 0 and 255 that collectively are called an RGB value

Coordinate Systems Each pixel can be identified using a two- dimensional coordinate system When referring to a pixel in a Java program, we use a coordinate system with the origin in the top- left corner to help place objects within the computer screen area. 112 Y X(0, 0) (112, 40) 40

End of the Chapter Challenge Programs – 250 Points Complete the following programs found in the Java Textbook on page Programming Project 1.1 and 1.2, make sure project 1.1 is working correctly before introducing any errors. Write down the error message or why the program worked.(50 points) Programming Projects 1.3,1.4, 1.5 and 1.6(50 points each)