ECE 122 Engineering Problem Solving with Java

Similar documents
Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

COMP 202 Java in one week

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

Chapter 1. Introduction

For the course, we will be using JCreator as the IDE (Integrated Development Environment).

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

An overview of Java, Data types and variables

CompSci 125 Lecture 02

CSC 1214: Object-Oriented Programming

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Welcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs

2 rd class Department of Programming. OOP with Java Programming

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Computer Components. Software{ User Programs. Operating System. Hardware

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

Building Java Programs. Introduction to Programming and Simple Java Programs

Computer Hardware. Java Software Solutions Lewis & Loftus. Key Hardware Components 12/17/2013

Program Fundamentals

Welcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

Building Java Programs. Chapter 1: Introduction to Java Programming

CSCI 2101 Java Style Guide

Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections

DM550 Introduction to Programming part 2. Jan Baumbach.

Computer Components. Software{ User Programs. Operating System. Hardware

Identifiers. Identifiers are the words a programmer uses in a program Some identifiers are already defined. Some are made up by the programmer:

Java Programming. Atul Prakash

Introduction to Algorithms and Data Structures

MP 3 A Lexer for MiniJava

Java language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

Chapter 2. Elementary Programming

Accelerating Information Technology Innovation

Pace University. Fundamental Concepts of CS121 1

CT 229 Fundamentals of Java Syntax

3. Java - Language Constructs I

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M.

Programming in C++ 4. The lexical basis of C++

Lecture 1: Basic Java Syntax

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

PROGRAMMING FUNDAMENTALS

Static Methods & Decomposition

COMP 202 Java in one week

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

Imports. Lexicon. Java/Lespérance 1. PROF. Y. LESPÉRANCE Dept. of Electrical Engineering & Computer Science

Java Programming Language Mr.Rungrote Phonkam

A web-based IDE for Java

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

Language Fundamentals Summary

Entering the world of Javatar

CS 106 Introduction to Computer Science I

About this exam review

Games Course, summer Introduction to Java. Frédéric Haziza

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

The MaSH Programming Language At the Statements Level

Introduction to C# Applications

CS1007: Object Oriented Design and Programming in Java. Lecture #2 Sept 8 Shlomo Hershkop Announcements

Getting started with Java

CIS 110: Introduction to Computer Programming

Lecture 3: Variables and assignment

Syntax and Variables

-Alfred North Whitehead. Copyright Pearson Education, 2010 Based on slides by Marty Stepp and Stuart Reges from

6.096 Introduction to C++ January (IAP) 2009

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

Programming Lecture 3

The keyword list thus far: The Random class. Generating "Random" Numbers. Topic 16

JAVA Ch. 4. Variables and Constants Lawrenceville Press

Classes, interfaces, & documentation. Review of basic building blocks

Topic 16. battle -they are strictly limited in number, they require fresh horses, and must only be made at decisive moments." -Alfred North Whitehead

CS 142 Style Guide Grading and Details

MEHMET YAYAN - İSMAİL HAKKI ÖZTÜRK CS101/SEC.-2 CLASS NOTES 1. March 28-30, 2007

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

: Primitive data types Variables Operators if, if-else do-while, while, for. // // First Java Program. public class Hello {

Administration. Conditional Statements. Agenda. Syntax. Flow of control. Lab 2 due now on floppy Lab 3 due tomorrow via FTP

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and More

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

CS 231 Data Structures and Algorithms, Fall 2016

Computer Science II Lecture 1 Introduction and Background

CS11 Java. Fall Lecture 1

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

The Java Language The Java Language Reference (2 nd ed.) is the defining document for the Java language. Most beginning programming students expect

CS 177 Week 15 Recitation Slides. Review

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

3. Java - Language Constructs I

University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner

UEE1302 (1102) F10: Introduction to Computers and Programming

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

Software Practice 1 Basic Grammar

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

JAVA GUI PROGRAMMING REVISION TOUR III

Java for Python Programmers. Comparison of Python and Java Constructs Reading: L&C, App B

BM214E Object Oriented Programming Lecture 4

Transcription:

ECE 122 Engineering Problem Solving with Java Introduction to Programming for ECE Lecture 1 Course Overview

Welcome! What is this class about? Java programming somewhat software somewhat Solving engineering problems with programming our main focus! What will I get out of this class A better understanding of specifying engineering problems Techniques for specifying engineering problems in Java A good understanding of the fundamentals of Java

Course resources The course web site contains important information associated with the course. Check the site frequently for homework info, assignments, tips, lectures slides, etc. Course web site: http://www.ecs.umass.edu/ece/ece122/ Course text: Java Software Solutions, eighth edition, Lewis and Loftus, Addison-Wesley You will only be responsible for material discussed in lecture and in discussion When in doubt refer to the lecture slides. Course software: DrJava Its free from drjava.org!

Course staff Prof. Russell Tessier - lecturer Graduate TAs Xuzhi Zhang Naveen Kumar Dumpala Shivukumar Patil Hao Dong ExSEL program Please come to our office hours and the laboratory sections Three email rule

Grade Composition 3 exams. 20%, 20%, 24% 6 homeworks 1% each 6 labs. 5% each Assignments must be turned in on time! Excuse 1: The server was down not likely Excuse 2: I accidently uploaded the wrong files check programs immediately before submission Excuse 3: My network connection went down make sure assignment is uploaded early

How do we often solve task-based problems? Example: A trip to the store 1. Get out of bed 2. Get dressed 3. Make list of items 4. Get into car 5. Drive to store 6. Pick items off shelf 7. Go to register 8. Drive home Observations - Activities take place sequentially, one at a time - The order of the operations matter - If the data is the same. I should get the same result every time. Question: How does a computer solve problems?

What is a Programming Language? A programming language allows programmers to specify tasks for the computer one task at a time. Just like most things in life The computer then executes this sequence of tasks on hardware to generate a result For the same data, the computer should get the same result every time. To solve engineering problems we need to: Specify the problem as a series of simple tasks Know how to specify these tasks (syntax, rules, format, tools, etc). Programming language for this semester: Java!

Java Program Structure // comments about the class public class MyProgram { class header class body } Comments can be placed almost anywhere

Java Program Structure // comments about the class public class MyProgram { // comments about the method public static void main (String[] args) { } method body method header }

Java Program Structure In the Java programming language: A program is made up of one or more classes A class contains one or more methods A method contains program statements These terms will be explored in detail throughout the course A Java application always contains a method called main

A Java Program /* Lewis/Loftus 6/11/2003 */ Lincoln.java demonstrates the basic structure of a Java Application. public class Lincoln { // starts the class definition These are single line comments // Prints a presidential quote. public static void main (String[] args) // this is a method name { System.out.println ( A quote by Abraham Lincoln: ); // invokes another method System.out.println ( Whatever you are, be a good one. ); // invokes another method } } // ends the class definition

What to Notice in Lincoln.java The first few lines between /* and */ are comments. Comments don t affect what the program does but are included to make the program easier to understand. Comments included in a program are called inline documentation. The comment symbols /* and */ can surround a multiline comment. The comment symbol // can be used at the beginning of a single-line comment.

Comments Comments are notes in the text of a program to assist that/any programmer who must later modify or simply understand the code. The original programmer often will not remember later the details of the program he or she has written. Comments within the text of a program are referred to as internal documentation. Good internal and external documentation are essential.

Two Types of Comments A single-line comment in Java takes the form: // This is a comment. A multi-line comment takes the form: /* */ This is one comment that spans several lines. It is also permissible to use the above notation for a single-line comment. /* This is a comment */

Good Programming Practices Our text presents guidelines for good programming practices Specific techniques for documenting programs. Be Verbose You can assume the reader is computer literate and familiar with Java. Assume the reader knows almost nothing about what the program is supposed to do. You won t be able to recognize what your program does after (at most) one week.

Identifiers and Reserved Words The words used when writing programs are called identifiers. There are three categories of identifiers: 1. Words that we make up (Lincoln and args) 2. Words that another programmer chose (String, System, out, println, and main). Often these are words that were chosen by a programmer for code that became part of a Java library; Now available for use by all Java programmers. 3. Words that are reserved for special purposes in the language (class, public, static, and void). The designers of the Java language chose these words.

The Reserved Words Reserved words are identifiers that have special meaning in a programming language. In the Lincoln program, they are class, public, static, and void. //******************************************************************** // Lincoln.java Author: Lewis/Loftus // // Demonstrates the basic structure of a Java application. //******************************************************************** public class Lincoln { //----------------------------------------------------------------- // Prints a presidential quote. //----------------------------------------------------------------- public static void main (String[] args) { System.out.println ("A quote by Abraham Lincoln:"); } } System.out.println ("Whatever you are, be a good one.");

Reserved Words The Java reserved words these words cannot be used for any other purpose, such as naming a class or method. 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

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 many ways Programs should be formatted to enhance readability, using consistent indentation

Summary Programs are a series of tasks for a computer to perform. A programming language defines how we specify the tasks Important to use many comments and to understand identifiers Reading: L+L: 1.1 1.4, Download and play with DrJava