Overview. Software Code is Everywhere. Software Crisis. Software crisis Development approaches Reusability Java packages API Sample classes:
|
|
- Melinda Leonard
- 6 years ago
- Views:
Transcription
1 Overview Software crisis Development approaches Reusability Java packages API Sample classes: String, Random, StringBuffer, StringTokenizer 8 November 2007 Ariel Shamir 1 Software Code is Everywhere Televisions: 500Kb of software Electric Shaver: 2Kb Power train cars: lines of computer code 100 millions of instructions space station 75 mercury 50 gemini 25 space shuttle apollo November 2007 Ariel Shamir 2 Software Crisis IBM consulting group: survey of 24 leading companies developing large distributed systems: 55% of the projects cost more than expected 68% overran their schedules 88% had to be substantially redesigned No important critical statistic: how reliably did complete systems ran? 8 November 2007 Ariel Shamir 3 1
2 Why? Software systems, from an engineering point of view, are perhaps the most complex machines ever built by humans Dynamic nature: requirements change constantly Complex inputs and outputs, complex processes Failure to expect the unexpected No one manager can comprehend the entirety - traditional development processes break down No quality control and productivity measurements 8 November 2007 Ariel Shamir 4 Program Life Cycle Development Use Maintenance 8 November 2007 Ariel Shamir 5 Maintenance Maintenance tasks include any modifications to an existing program. It includes defect removal (debugging) and enhancements Maintenance efforts tend to far outweigh the development effort in today s software Small increases in effort at the development stage can greatly reduce maintenance tasks 8 November 2007 Ariel Shamir 6 2
3 Build and Fix Approach Too many programmers follow a buildand-fix approach: They write a program and modify it until it is functional, without regard to system design Errors are addressed as they are discovered It is not really a development model at all!! 8 November 2007 Ariel Shamir 7 Waterfall Approach Establishing clear and unambiguous requirements Creating a clean design from the requirements Implementing the design Testing the implementation 8 November 2007 Ariel Shamir 8 Waterfall Diagram Establish requirements Create design Implement code Not realistic!! Test system 8 November 2007 Ariel Shamir 9 3
4 Iterative Approach Allows the developer to backtrack and cycle through the different development stages Establish requirements Create design Implement code Test system 8 November 2007 Ariel Shamir 10 Possible Solutions Brute-force approach to bug removal: Beta versions: hordes of users dig up the glitches QA departments Use formal methods - translate requirements and code to a language which can be analyzed mathematically Put more emphasis on requirements and design to avoid problems later 8 November 2007 Ariel Shamir 11 Reusability Another option is to promote reusability Mass production of software must rely on interchangeable, reusable, and aging components, which are already tested and robust If you do not have to write everything from scratch, you can concentrate on the important tasks OOP: reusability of small components is built in the language! 8 November 2007 Ariel Shamir 12 4
5 Java API (Packages) Java comes with 3,000+ pre-designed components. The Java API is the library of classes supplied by Java. The classes in the Java API is separated into packages. Each package contains a set of classes that are related in some way. 8 November 2007 Ariel Shamir 13 The Java API Packages java.applet java.awt java.beans java.io java.lang java.math... java.net java.rmi java.security java.sql java.text java.util 8 November 2007 Ariel Shamir 14 Example Packages java.lang:general java.applet : Programs that transported across the Web. java.awt:graphics, windows, GUI. java.math: Calculations, math. java.net: Communication. 8 November 2007 Ariel Shamir 15 5
6 Documentation: List of Packages Details of Packages List of Classes 8 November 2007 Ariel Shamir 16 java.lang Choose java.lang from list of Packages Details of Classes List of Classes defined in Package 8 November 2007 Ariel Shamir 17 String Class Class Hierarchy Class Documentation 8 November 2007 Ariel Shamir 18 6
7 String Methods Methods List 8 November 2007 Ariel Shamir 19 Importing Packages Using a class from the Java API can be accomplished by using its fully qualified name: java.util.random random = new java.util.random(); Or the class can be imported once with the import statement at the top of the file: import java.util.random;... Random random = new Random(); 8 November 2007 Ariel Shamir 20 Importing Packages You can also import all the classes in a given package with a single import statement: import java.util.*; The java.lang package is automatically imported into every Java program. 8 November 2007 Ariel Shamir 21 7
8 The Random Class A program may need to produce a random number (DiceSimulation.java). The Random class provides methods to simulate a random number generator. The nextint method returns a random number from the entire spectrum of int values. Usually, this number is be scaled and shifted to the desired range. 8 November 2007 Ariel Shamir 22 Random Class Example import java.util.random; // This program simulates a tossing of a dice class DiceSimulation { static final int NUMBER_OF_TOSSES = 10; public static void main(string[] args) { int sum; int count = 0; Random random = new Random(); 8 November 2007 Ariel Shamir 23 Random Class Example while(count<=number_of_tosses) { int result = Math.abs(random.nextInt())%6+1; sum = sum + result; System.out.println( The sum of tosses is +sum); 8 November 2007 Ariel Shamir 24 8
9 The String Class A character string in Java is an object, defined by the String class String name = new String ("Ken Arnold"); Because strings are so common, Java allows an abbreviated syntax: String name = "Ken Arnold"; Java strings are immutable; once a string object has a value, it cannot be changed! 8 November 2007 Ariel Shamir 25 String Class Example String sentence = Houston, we have a problem. ; int length = sentence.length(); // length=27 String word = sentence.substring(0,7); //= Houston word = word.tolowercase(); // word = houston ; char c = word.charat(2); // c = u boolean b = word.equals( Houston ); // b=false int index = sentence.indexof( we ); word = sentence.substring(index, index+3); // = we word = word.trim(); // word= we 8 November 2007 Ariel Shamir 26 String Conversions Type To String From String boolean String.ValueOf(boolean) new Boolean(String). booleanvalue() int String.ValueOf(int) Integer. long String.ValueOf(long) Long. ParseInt(String,int base) ParseLong(String,int base) float String.ValueOf(float) new Float(String).floatValue() double String.ValueOf(double) new Double(String).doubleValue() 8 November 2007 Ariel Shamir 27 9
10 String Conversion Example String s = "100"; int i = Integer.parseInt(s,10); long ii = Long.parseLong(s,10); s = " "; Double d_obj = new Double(s); double d = d_obj.doublevalue(); float f = new Float(s).floatValue(); 8 November 2007 Ariel Shamir 28 More Conversions boolean b = false; int i=100; double d=123.45; char c= x ; String s1=string.valueof(b), //s1== false s2=string.valueof(i), //s2== 100 s3=string.valueof(d), //s3== s4=string.valueof(c); //s4== x 8 November 2007 Ariel Shamir 29 The StringBuffer Class String class is immutable. The StringBuffer class allows to use dynamic strings - which can be modified: append(char c) insert(int index, char c) charat(int index) setcharat(int index, char c) reverse() length() 8 November 2007 Ariel Shamir 30 10
11 StringBuffer Class Example StringBuffer text1 = new StringBuffer(); StringBuffer text2 = new StringBuffer( m ); StringBuffer text3 = new StringBuffer( 1 dollar ); text1.append(1); text1.append( p ); text1.append( e ); text1.append( n ); text1.append( ny ); 8 November 2007 Ariel Shamir 31 StringBuffer Class Example text2.insert(0,1); text2.insert(2, di ); text3.insert(5, e ); System.out.println(text1); System.out.println(text2); System.out.println(text3); text3.reverse(); System.out.println(text3); 8 November 2007 Ariel Shamir 32 Example Output 1 penny 1 dime 1 dollar rallod 1 8 November 2007 Ariel Shamir 33 11
12 More Scanner Class We have seen that the Scanner class is defined in the java.util package. The Scanner class can also be used to break up a string into pieces called s. By default the delimiters for the s are the white space characters (space, tab, new line). It can also be used to read from files (more on this later). 8 November 2007 Ariel Shamir 34 Break to Words Example input: Hello, my name is Dani. output: Hello, my name is Dani. 8 November 2007 Ariel Shamir 35 Scanner Programming Example String poem = Que sera sera, whatever will ; Scanner = new Scanner(poem); String ; while (.hasnext()) { =.next(); System.out.println(); 8 November 2007 Ariel Shamir 36 12
13 String poem = Que sera sera, whatever will be will be ; Scanner = new Scanner(poem); String ; Que sera sera, whatever will Value not defined 8 November 2007 Ariel Shamir 37 while (.hasnext()) { Que sera sera, whatever will hasnext() true 8 November 2007 Ariel Shamir 38 =.next(); sera sera, whatever will next() Que 8 November 2007 Ariel Shamir 39 13
14 =.next(); sera sera, whatever will Que 8 November 2007 Ariel Shamir 40 while (. hasnext()) { sera sera, whatever will hasnext() Que 8 November 2007 Ariel Shamir 41 while (.hasnext()) { sera sera, whatever will true Que 8 November 2007 Ariel Shamir 42 14
15 =.next(); sera, whatever will next() sera Que 8 November 2007 Ariel Shamir 43 =.next(); sera, whatever will sera Que 8 November 2007 Ariel Shamir 44 =.next(); sera, whatever will sera Que 8 November 2007 Ariel Shamir 45 15
16 =.next(); sera, whatever will sera 8 November 2007 Ariel Shamir 46 =.hasnext(); sera, whatever will hasnext() sera 8 November 2007 Ariel Shamir 47 =.next(); whatever will sera, sera 8 November 2007 Ariel Shamir 48 16
17 =.next(); whatever will sera, sera 8 November 2007 Ariel Shamir 49 =.next(); whatever will sera, sera 8 November 2007 Ariel Shamir 50 // This program gets a sentence from the // user and output each word in the // sentence on a separate line. import java.util.scanner; class BreakSentence { public static void main(string[] args) { Scanner scan = new Scanner (System.in); System.out.println("Please enter a sentence"); String sentence = scan.nextline(); Scanner = new Scanner(sentence); String ; while (.hasnext()) { =.next(); System.out.println(); 8 November 2007 Ariel Shamir 51 17
18 // This program gets a sentence from the // user and output each part separated by // a comma on a separate line. import java.util.scanner; class BreakSentence { public static void main(string[] args) { Scanner scan = new Scanner (System.in); System.out.println("Please enter a sentence"); String sentence = scan.nextline(); Scanner = new Scanner(sentence);.useDelimiter("\\s*,\\s*"); String ; while (.hasnext()) { =.next(); System.out.println(); 8 November 2007 Ariel Shamir 52 18
Objectives of CS 230. Java portability. Why ADTs? 8/18/14
http://cs.wellesley.edu/~cs230 Objectives of CS 230 Teach main ideas of programming Data abstraction Modularity Performance analysis Basic abstract data types (ADTs) Make you a more competent programmer
More informationA variable is a name for a location in memory A variable must be declared
Variables A variable is a name for a location in memory A variable must be declared, specifying the variable's name and the type of information that will be held in it data type variable name int total;
More informationCSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI
CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are
More informationCOMP 202. Built in Libraries and objects. CONTENTS: Introduction to objects Introduction to some basic Java libraries string
COMP 202 Built in Libraries and objects CONTENTS: Introduction to objects Introduction to some basic Java libraries string COMP 202 Objects and Built in Libraries 1 Classes and Objects An object is an
More informationWe now start exploring some key elements of the Java programming language and ways of performing I/O
We now start exploring some key elements of the Java programming language and ways of performing I/O This week we focus on: Introduction to objects The String class String concatenation Creating objects
More informationECE 122 Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 3 Expression Evaluation and Program Interaction Outline Problem: How do I input data and use it in complicated expressions Creating complicated expressions
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #04: Fall 2015 1/20 Office hours Monday, Wednesday: 10:15 am to 12:00 noon Tuesday, Thursday: 2:00 to 3:45 pm Office: Lindley Hall, Room 401C 2/20 Printing
More informationLab5. Wooseok Kim
Lab5 Wooseok Kim wkim3@albany.edu www.cs.albany.edu/~wooseok/201 Question Answer Points 1 A or B 8 2 A 8 3 D 8 4 20 5 for class 10 for main 5 points for output 5 D or E 8 6 B 8 7 1 15 8 D 8 9 C 8 10 B
More informationIntroduction to Computer Science I
Introduction to Computer Science I String and Random Java Classes Janyl Jumadinova 12-13 February, 2018 Divide and Conquer Most programs are complex and involved. The best way to develop and maintain a
More informationProgramming Constructs Overview. Method Call System.out.print( hello ); Method Parameters
Programming Constructs Overview Method calls More selection statements More assignment operators Conditional operator Unary increment and decrement operators Iteration statements Defining methods 27 October
More informationString related classes
Java Strings String related classes Java provides three String related classes java.lang package String class: Storing and processing Strings but Strings created using the String class cannot be modified
More informationChapter. Let's explore some other fundamental programming concepts
Data and Expressions 2 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Data and Expressions Let's explore some
More informationObjects and Classes -- Introduction
Objects and Classes -- Introduction Now that some low-level programming concepts have been established, we can examine objects in more detail Chapter 4 focuses on: the concept of objects the use of classes
More informationData Conversion & Scanner Class
Data Conversion & Scanner Class Quick review of last lecture August 29, 2007 ComS 207: Programming I (in Java) Iowa State University, FALL 2007 Instructor: Alexander Stoytchev Numeric Primitive Data Storing
More informationData and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:
Data and Expressions Data and Expressions Let's explore some other fundamental programming concepts Chapter 2 focuses on: Character Strings Primitive Data The Declaration And Use Of Variables Expressions
More informationCSCI 2010 Principles of Computer Science. Basic Java Programming. 08/09/2013 CSCI Basic Java 1
CSCI 2010 Principles of Computer Science Basic Java Programming 1 Today s Topics Using Classes and Objects object creation and object references the String class and its methods the Java standard class
More informationChapter 4 Classes in the Java Class Libraries
Programming Fundamental I ACS-1903 Chapter 4 Classes in the Java Class Libraries 1 Random Random The Random class provides a capability to generate pseudorandom values pseudorandom because the stream of
More informationLab5. Wooseok Kim
Lab5 Wooseok Kim wkim3@albany.edu www.cs.albany.edu/~wooseok/201 Question Answer Points 1 A 8 2 A 8 3 E 8 4 D 8 5 20 5 for class 10 for main 5 points for output 6 A 8 7 B 8 8 0 15 9 D 8 10 B 8 Question
More informationCOMP6700/2140 Std. Lib., I/O
COMP6700/2140 Std Lib, I/O Alexei B Khorev and Joshua Milthorpe Research School of Computer Science, ANU February 2017 Alexei B Khorev and Joshua Milthorpe (RSCS, ANU) COMP6700/2140 Std Lib, I/O February
More informationUsing Classes and Objects
Using Classes and Objects CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Today
More informationChap. 3. Creating Objects The String class Java Class Library (Packages) Math.random() Reading for this Lecture: L&L,
Chap. 3 Creating Objects The String class Java Class Library (Packages) Math.random() Reading for this Lecture: L&L, 3.1 3.6 1 From last time: Account Declaring an Account object: Account acct1 = new Account
More informationJava I/O and Control Structures
Java I/O and Control Structures CSC 2014 Java Bootcamp Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Some slides in this presentation are adapted from the slides accompanying
More informationFormatting Output & Enumerated Types & Wrapper Classes
Formatting Output & Enumerated Types & Wrapper Classes Quick review of last lecture September 8, 2006 ComS 207: Programming I (in Java) Iowa State University, FALL 2006 Instructor: Alexander Stoytchev
More informationAP Computer Science Unit 1. Programs
AP Computer Science Unit 1. Programs Open DrJava. Under the File menu click on New Java Class and the window to the right should appear. Fill in the information as shown and click OK. This code is generated
More informationCode Listing H-1. (Car.java) H-2 Appendix H Packages
APPENDIX H Packages NOTE: To use this appendix you must understand how your operating system uses directories, or folders. In addition, you must know how to set the value of an environment variable. The
More informationAlgorithms and Java basics: pseudocode, variables, assignment, and interactive programs
Algorithms and Java basics: pseudocode, variables, assignment, and interactive programs CSC 1051 Algorithms and Data Structures I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova
More informationComputer Science 145 Midterm 1 Fall 2016
Computer Science 145 Midterm 1 Fall 2016 Doodle here. This is a closed-book, no-calculator, no-electronic-devices, individual-effort exam. You may reference one page of handwritten notes. All answers should
More informationUsing Classes and Objects. Chapter
Using Classes and Objects 3 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Using Classes and Objects To create
More informationJava I/O and Control Structures Algorithms in everyday life
Introduction Java I/O and Control Structures Algorithms in everyday life CSC 2014 Java Bootcamp Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Source: http://xkcd.com/627/
More informationAlgorithms and Java basics: pseudocode, variables, assignment, and interactive programs
Algorithms and Java basics: pseudocode, variables, assignment, and interactive programs CSC 1051 Algorithms and Data Structures I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova
More informationData Representation Classes, and the Java API
Data Representation Classes, and the Java API CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: http://www.csc.villanova.edu/~map/1051/
More informationAP Computer Science Unit 1. Writing Programs Using BlueJ
AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationProgramming with Java
Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules
More informationCS 112 Introduction to Programming
CS 112 Introduction to Programming Summary of Methods; User Input using Scanner Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone: 432-6400 Email: yry@cs.yale.edu Admin
More informationIntroduction to Java Unit 1. Using BlueJ to Write Programs
Introduction to Java Unit 1. Using BlueJ to Write Programs 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationReading Input from Text File
Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Lab 5 Reading Input from Text File Eng. Mohammed Alokshiya November 2, 2014 The simplest
More informationCS 211: Existing Classes in the Java Library
CS 211: Existing Classes in the Java Library Chris Kauffman Week 3-2 Logisitics Logistics P1 Due tonight: Questions? Late policy? Lab 3 Exercises Thu/Fri Play with Scanner Introduce it today Goals Class
More informationPackages & Random and Math Classes
Packages & Random and Math Classes Quick review of last lecture September 6, 2006 ComS 207: Programming I (in Java) Iowa State University, FALL 2006 Instructor: Alexander Stoytchev Objects Classes An object
More informationPrimitive Data, Variables, and Expressions; Simple Conditional Execution
Unit 2, Part 1 Primitive Data, Variables, and Expressions; Simple Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Overview of the Programming Process Analysis/Specification
More informationAP Computer Science Unit 1. Writing Programs Using BlueJ
AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 2: Data and Expressions CS 121 1 / 53 Chapter 2 Part 1: Data Types
More informationAlgorithms in everyday life. Algorithms. Algorithms and Java basics: pseudocode, variables, assignment, and interactive programs
Data and Algorithms Algorithms and Java basics: pseudocode, variables, assignment, and interactive programs Algorithms in everyday life CSC 1051 Algorithms and Data Structures I Dr. Mary-Angela Papalaskari
More informationReview Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013
Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:
More informationChapter Goals. Chapter 7 Designing Classes. Discovering Classes Actors (end in -er, -or) objects do some kinds of work for you: Discovering Classes
Chapter Goals Chapter 7 Designing Classes To learn how to discover appropriate classes for a given problem To understand the concepts of cohesion and coupling To minimize the use of side effects To document
More informationHandout 5 cs180 - Programming Fundamentals Spring 15 Page 1 of 8. Handout 5. Loops.
Handout 5 cs180 - Programming Fundamentals Spring 15 Page 1 of 8 Handout 5 Loops. Loops implement repetitive computation, a k a iteration. Java loop statements: while do-while for 1. Start with the while-loop.
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More informationComputational Expression
Computational Expression String Class Janyl Jumadinova 24 September, 2018 Janyl Jumadinova Computational Expression 24 September, 2018 1 / 16 Data Types: Review Java has two categories of data: - primitive
More informationCONTENTS: Compilation Data and Expressions COMP 202. More on Chapter 2
CONTENTS: Compilation Data and Expressions COMP 202 More on Chapter 2 Programming Language Levels There are many programming language levels: machine language assembly language high-level language Java,
More informationChapter 2. Elementary Programming
Chapter 2 Elementary Programming 1 Objectives To write Java programs to perform simple calculations To obtain input from the console using the Scanner class To use identifiers to name variables, constants,
More informationClasses and Objects Part 1
COMP-202 Classes and Objects Part 1 Lecture Outline Object Identity, State, Behaviour Class Libraries Import Statement, Packages Object Interface and Implementation Object Life Cycle Creation, Destruction
More informationClass Libraries and Packages
Class Libraries and Packages Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.jku.at http://www.risc.jku.at Wolfgang
More informationObject Oriented Programming. Java-Lecture 1
Object Oriented Programming Java-Lecture 1 Standard output System.out is known as the standard output object Methods to display text onto the standard output System.out.print prints text onto the screen
More informationStrings and Loops CSE moodle.yorku.ca. moodle.yorku.ca CSE 1020
Strings and Loops CSE 1020 moodle.yorku.ca Strings Strings are immutable objects. The state of an immutable object cannot be changed. The String API does not contain any mutators. The StringBuffer class
More informationCEN 414 Java Programming
CEN 414 Java Programming Instructor: H. Esin ÜNAL SPRING 2017 Slides are modified from original slides of Y. Daniel Liang WEEK 2 ELEMENTARY PROGRAMMING 2 Computing the Area of a Circle public class ComputeArea
More informationFundamentals of Programming Data Types & Methods
Fundamentals of Programming Data Types & Methods By Budditha Hettige Overview Summary (Previous Lesson) Java Data types Default values Variables Input data from keyboard Display results Methods Operators
More informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University January 15, 2015 Chapter 2: Data and Expressions CS 121 1 / 1 Chapter 2 Part 1: Data
More informationJava Intro 3. Java Intro 3. Class Libraries and the Java API. Outline
Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics
WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java
More informationCSE1720 Delegation Concepts (Ch 2)
CSE1720 Delegation Concepts (Ch 2) Output (sec 2.2.5) Output to the console Output to a file (later section 5.3.2) Instead of System.out.println( Hi ); Use: output.println( Hi ); 1 2 Ready-Made I/O Components
More informationCOMP 202 Java in one week
CONTENTS: Basics of Programming Variables and Assignment Data Types: int, float, (string) Example: Implementing a calculator COMP 202 Java in one week The Java Programming Language A programming language
More informationUsing Classes and Objects
Using Classes and Objects CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ The
More informationHello World. n Variables store information. n You can think of them like boxes. n They hold values. n The value of a variable is its current contents
Variables in a programming language Basic Computation (Savitch, Chapter 2) TOPICS Variables and Data Types Expressions and Operators Integers and Real Numbers Characters and Strings Input and Output Variables
More informationUSING LIBRARY CLASSES
USING LIBRARY CLASSES Simple input, output. String, static variables and static methods, packages and import statements. Q. What is the difference between byte oriented IO and character oriented IO? How
More informationChapter 3. Selections
Chapter 3 Selections 1 Outline 1. Flow of Control 2. Conditional Statements 3. The if Statement 4. The if-else Statement 5. The Conditional operator 6. The Switch Statement 7. Useful Hints 2 1. Flow of
More informationMethods (Deitel chapter 6)
Methods (Deitel chapter 6) 1 Plan 2 Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods
More informationMethods (Deitel chapter 6)
1 Plan 2 Methods (Deitel chapter ) Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 4 Creating and Using Objects Outline Problem: How do I create multiple objects from a class Java provides a number of built-in classes for us Understanding
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 4 Creating and Using Objects Outline Problem: How do I create multiple objects from a class Java provides a number of built-in classes for us Understanding
More informationing execution. That way, new results can be computed each time the Class The Scanner
ing execution. That way, new results can be computed each time the run, depending on the data that is entered. The Scanner Class The Scanner class, which is part of the standard Java class provides convenient
More informationSection 003 Fall CS 170 Exam 1. Name (print): Instructions:
CS 170 Exam 1 Section 003 Fall 2012 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationObject-Based Programming. Programming with Objects
ITEC1620 Object-Based Programming g Lecture 8 Programming with Objects Review Sequence, Branching, Looping Primitive datatypes Mathematical operations Four-function calculator Scientific calculator Don
More information2: Basics of Java Programming
2: Basics of Java Programming CSC 1051 Algorithms and Data Structures I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/
More informationCSC 1051 Algorithms and Data Structures I. Midterm Examination February 24, Name: KEY 1
CSC 1051 Algorithms and Data Structures I Midterm Examination February 24, 2014 Name: KEY 1 Question Value Score 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 TOTAL 100 Please answer questions in
More informationAlgorithms in everyday life. Algorithms. Algorithms and Java basics: pseudocode, variables, assignment, and interactive programs
Data and Algorithms Algorithms and Java basics: pseudocode, variables, assignment, and interactive programs Algorithms in everyday life CSC 1051 Algorithms and Data Structures I Dr. Mary-Angela Papalaskari
More informationFull file at
Chapter 1 Primitive Java Weiss 4 th Edition Solutions to Exercises (US Version) 1.1 Key Concepts and How To Teach Them This chapter introduces primitive features of Java found in all languages such as
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationUsing Classes and Objects Chapters 3 Creating Objects Section 3.1 The String Class Section 3.2 The Scanner Class Section 2.6
Using Classes and Objects Chapters 3 Creating Objects Section 3.1 The String Class Section 3.2 The Scanner Class Section 2.6 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 2 Scope Creating
More informationJava Foundations: Introduction to Program Design & Data Structures, 4e John Lewis, Peter DePasquale, Joseph Chase Test Bank: Chapter 2
Java Foundations Introduction to Program Design and Data Structures 4th Edition Lewis TEST BANK Full download at : https://testbankreal.com/download/java-foundations-introduction-toprogram-design-and-data-structures-4th-edition-lewis-test-bank/
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationToday s plan Discuss the Bb quiz 1 Clarify Lab 1 Review basic Java materials Classes, Objects, Interfaces Strings Java IO. Understanding Board
Ananda Gunawardena Today s plan Discuss the Bb quiz 1 Clarify Lab 1 Review basic Java materials Classes, Objects, Interfaces Strings Java IO Lab 1 Objectives Learn how to structure TicTacToeprogram as
More informationUniversità degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M tutor Isam M. Al Jawarneh, PhD student isam.aljawarneh3@unibo.it Mobile Middleware
More informationCSC 1051 Algorithms and Data Structures I. Midterm Examination February 26, Name: Key
CSC 1051 Algorithms and Data Structures I Midterm Examination February 26, 2015 Name: Key Question Value 1 10 Score 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 TOTAL 100 Please answer questions in the
More informationJava Foundations Certified Junior Associate
Java Foundations Certified Junior Associate 习题 1. When the program runs normally (when not in debug mode), which statement is true about breakpoints? Breakpoints will stop program execution at the last
More informationCOE 212 Engineering Programming. Welcome to Exam II Monday May 13, 2013
1 COE 212 Engineering Programming Welcome to Exam II Monday May 13, 2013 Instructors: Dr. Randa Zakhour Dr. Maurice Khabbaz Dr. George Sakr Dr. Wissam F. Fawaz Name: Solution Key Student ID: Instructions:
More informationSelected Questions from by Nageshwara Rao
Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)
More informationTools : The Java Compiler. The Java Interpreter. The Java Debugger
Tools : The Java Compiler javac [ options ] filename.java... -depend: Causes recompilation of class files on which the source files given as command line arguments recursively depend. -O: Optimizes code,
More informationWhat did we talk about last time? Examples switch statements
Week 4 - Friday What did we talk about last time? Examples switch statements History of computers Hardware Software development Basic Java syntax Output with System.out.print() Mechanical Calculation
More informationIntroduction to Java Applications
2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use
More informationAn overview of Java, Data types and variables
An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public
More informationChapter 3: Using Classes and Objects
Chapter 3: Using Classes and Objects CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Chapter 3: Using Classes and Objects CS 121 1 / 51 Chapter 3 Topics
More informationUsing Classes and Objects
Using Classes and Objects The Java class library or Java API (Application Programming Interface) CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova
More informationObject Oriented Programming with Java
Object Oriented Programming with Java What is Object Oriented Programming? Object Oriented Programming consists of creating outline structures that are easily reused over and over again. There are four
More informationConstants. Why Use Constants? main Method Arguments. CS256 Computer Science I Kevin Sahr, PhD. Lecture 25: Miscellaneous
CS256 Computer Science I Kevin Sahr, PhD Lecture 25: Miscellaneous 1 main Method Arguments recall the method header of the main method note the argument list public static void main (String [] args) we
More informationCOMP-202 More Complex OOP
COMP-202 More Complex OOP Defining your own types: Remember that we can define our own types/classes. These classes are objects and have attributes and behaviors You create an object or an instance of
More informationCompSci 125 Lecture 05. Programming Style, String Class and Literals, Static Methods, Packages
CompSci 125 Lecture 05 Programming Style, String Class and Literals, Static Methods, Packages Homework Update HW2 Due 9/13 Programming Assignment Update p1: Traffic Applet due Sept 21 Programming Style
More informationToday s plan Discuss the Lab 1 Show Lab 2 Review basic Java materials Java API Strings Java IO
Today s plan Discuss the Lab 1 Show Lab 2 Review basic Java materials Java API Strings Java IO Ananda Gunawardena Objects and Methods working together to solve a problem Object Oriented Programming Paradigm
More informationSection 2.2 Your First Program in Java: Printing a Line of Text
Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two
More informationName: Checked: Access the Java API at the link above. Why is it abbreviated to Java SE (what does the SE stand for)?
Lab 6 Name: Checked: Objectives: Learn about the Java API Test code snippets interactively to explore data representation and casts Practice using Math, Random, String, and other classes from the Java
More informationCS 180. Recitation 8 / {30, 31} / 2007
CS 180 Recitation 8 / 30, 31 / 2007 Announcements Project 1 is out Due 9/5 @ 10:00pm Start early! Use the newsgroup for your questions LWSN B146 Lab help hours 7-10pm Monday through Wednesday Naming Conventions
More information