$ % $ % BankAccount. public class BankAccount {... private??? balance; } "commands, transformers, mutators! "abstract state! "queries, accessors!
|
|
- Allen Cooper
- 6 years ago
- Views:
Transcription
1 "! public class { private??? balance; "! # "! "commands, transformers, mutators! "abstract state! "queries, accessors! "constructors! & "! public class { private double balance;
2 "! void "this! x.command1(); x.command2(); x.command3(); x.command1().command2().command3(); e.g. new StringBuilder().append("19").append(84).toString(); ( ' setter/getter setter/getter" private! - -. private double balance getter setter public class { public double getbalance() { return balance; public long getaccountnumber() { return accountnumber; public Customer getowner { return owner; private double balance; private long accountnumber; private Customer owner; field field() Java field getfield() *GUI Builders JavaBeans, ) --* * Makes a deposit to the current account amount > 0, "amount is positive" getbalance() == prev(getbalance()) amount, * "balance updated according to deposit" public void deposit(double amount) { balance = amount; --* deposit //
3 --* --* * Withdraw amount from the current account amount <= getbalance(), "can't overdraft" 0 < amount, "amount is positive" getbalance() == prev(getbalance()) - amount, * "balance updated according to withdraw" public void withdraw(double amount) { balance -= amount; withdraw. / / # "! * Makes a transfer of amount from one account to the other 0 < amount <= from.getbalance(), "from can't overdraft" to.getbalance() == prev(to.getbalance()) amount from.getbalance() == prev(from.getbalance()) - amount public static void transfer(double amount, from, to) { from.withdraw(amount); to.deposit(amount); deposit*withdraw. / * Makes a transfer of amount from other to the current account 0 < amount, "amount is positive" amount <= other.getbalance(), "other can't overdraft" getbalance() == prev(getbalance()) amount, * balance updated other.getbalance() == prev(other.getbalance()) amount, * balance of other updated public void deposit(double amount, other) { other.withdraw(amount); balance = amount; & * This class represents a bank account getbalance() >= 0, * "can't overdraft" getaccountnumber() > 0, * "an account must have an identifier" owner()!= null, * "an account must have owner" public class { ( " class invariant! '
4 * Constructs a new account and sets its owner and * identifier id > 0, "account number must be positive" customer!= null, * "an account must have an owner" getowner() == customer, * "argument was assigned getaccountnumber() == id, * "argument was assigned" public (Customer customer, long id) { accountnumber = id; owner = customer; 0. "! "encapsulation!, ret == balance, * "consistency of representation" public double getbalance() { privatebalance final * final*accountnumber final private long accountnumber; "blank final! * This class represents a bank account getbalance() == balance, * balance interface is consistent with representation" getowner() == owner * owner interface is consistent with representation" public class {
5 Project ->Generate Javadoc & *.. public. private private Use Standard Doclet Destination HTML " configure!. " Java SDK!JDK Sun C:\Program Files\Java\jdk1.5.x_xx\bin\.exe " x*! ( @imp_post / taglets.jar1 D:\ohad\soft1\taglets.jar NextGenerate Javadoc Finish html, )
6 Extra Javadoc options -taglet il.ac.tau.cs.software1.util.pretaglet -taglet il.ac.tau.cs.software1.util.posttaglet -taglet il.ac.tau.cs.software1.util.invtaglet -taglet il.ac.tau.cs.software1.util.impposttaglet -taglet il.ac.tau.cs.software1.util.impinvtaglet -tagletpath D:\ohad\soft1\taglets.jar taglets.jar1 Finish
BankAccount account1 = new BankAccount(...);,this
1 6 ',, : (.new ) BankAccount account1 = new BankAccount(...); פ, פ,this,, ) \ פ\( פ פ פ 2 ) ( " פ : :? public class BankAccount {... private double balance;... 3 :),, ( 3 )queries, accessors( ), ( :)observers(
More informationEncapsulation. Mason Vail Boise State University Computer Science
Encapsulation Mason Vail Boise State University Computer Science Pillars of Object-Oriented Programming Encapsulation Inheritance Polymorphism Abstraction (sometimes) Object Identity Data (variables) make
More informationCSE115 Introduction to Computer Science I Coding Exercise #7 Retrospective Fall 2017
This week the main activity was a quiz activity, with a structure similar to our Friday lecture activities. The retrospective for the quiz is in Quiz-07- retrospective.pdf This retrospective explores the
More informationClasses and Methods: Classes
Class declaration Syntax: [] Classes and Methods: Classes [] class [] [] [] When
More informationpublic class Account { private int id; private static int nextaccountid = 0; private String name; private double balance;
public class Account { private int id; private static int nextaccountid = 0; private String name; private double balance; public double deposit(double amount) { public double withdraw(double amount) {
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 6 Problem Definition and Implementation Outline Problem: Create, read in and print out four sets of student grades Setting up the problem Breaking
More informationPractice problem on defining and using Class types. Part 4.
CS180 Programming Fundamentals Practice problem on defining and using Class types. Part 4. Implementing object associations: Applications typically consist of collections of objects of different related
More informationCOMP-202 Unit 8: Defining Your Own Classes. CONTENTS: Class Definitions Attributes Methods and Constructors Access Modifiers and Encapsulation
COMP-202 Unit 8: Defining Your Own Classes CONTENTS: Class Definitions Attributes Methods and Constructors Access Modifiers and Encapsulation Defining Our Own Classes (1) So far, we have been creating
More informationEXAMINATIONS 2012 END-OF-YEAR SWEN222. Software Design. Question Topic Marks 1. Design Quality Design Patterns Design by Contract 12
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Student ID:..................... EXAMINATIONS 2012 END-OF-YEAR SWEN222 Software Design Time
More informationCS112 Lecture: Defining Instantiable Classes
CS112 Lecture: Defining Instantiable Classes Last revised 2/3/05 Objectives: 1. To describe the process of defining an instantiable class 2. To discuss public and private visibility modifiers. Materials:
More informationImplementing Classes (P1 2006/2007)
Implementing Classes (P1 2006/2007) Fernando Brito e Abreu (fba@di.fct.unl.pt) Universidade Nova de Lisboa (http://www.unl.pt) QUASAR Research Group (http://ctp.di.fct.unl.pt/quasar) Chapter Goals To become
More informationLecture 07: Object Encapsulation & References AITI Nigeria Summer 2012 University of Lagos.
Accelerating Information Technology Innovation http://aiti.mit.edu Lecture 07: Object Encapsulation & References AITI Nigeria Summer 2012 University of Lagos. Data Field Encapsulation Sometimes we want
More informationImplementing Classes
Implementing Classes Advanced Programming ICOM 4015 Lecture 3 Reading: Java Concepts Chapter 3 Fall 2006 Slides adapted from Java Concepts companion slides 1 Chapter Goals To become familiar with the process
More informationOutline CSE 142. Specification vs Implementation - Review. CSE142 Wi03 F-1. Instance Variables
Outline CSE 142 Class Implementation in Java Implementing classes in Java Instance variables properties Value-returning methods for queries Void methods for commands Return statement Assignment statement
More informationAgenda: Notes on Chapter 3. Create a class with constructors and methods.
Bell Work 9/19/16: How would you call the default constructor for a class called BankAccount? Agenda: Notes on Chapter 3. Create a class with constructors and methods. Objectives: To become familiar with
More informationICOM 4015: Advanced Programming
ICOM 4015: Advanced Programming Lecture 3 Reading: Chapter Three: Implementing Classes Copyright 2009 by John Wiley & Sons. All rights reserved. Chapter Three - Implementing Classes Chapter Goals To become
More informationPractical Session 2 Correction Don't forget to put the InputValue.java file in each project
Practical Session 2 Correction Don't forget to put the InputValue.java file in each project Exercise 1 : Bank Account 1) BankAccount class A bank account is a financial account with a banking institution
More informationAnatomy of a Method. HW3 is due Today. September 15, Midterm 1. Quick review of last lecture. Encapsulation. Encapsulation
Anatomy of a Method September 15, 2006 HW3 is due Today ComS 207: Programming I (in Java) Iowa State University, FALL 2006 Instructor: Alexander Stoytchev Midterm 1 Next Tuesday Sep 19 @ 6:30 7:45pm. Location:
More informationWhat will this print?
class UselessObject{ What will this print? int evennumber; int oddnumber; public int getsum(){ int evennumber = 5; return evennumber + oddnumber; public static void main(string[] args){ UselessObject a
More informationBloomBank Financial Software Design
BloomBank Financial Software Design CIS 3023 Project 6 Due date: Report on project classes and methods - July 27 th, 200 (Tue) Complete implementation - August 3 rd, 200 (Tue) Problem Statement: You work
More informationBinghamton University. CS-140 Fall Problem Solving. Creating a class from scratch
Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods
More informationStoring Data in Objects
Storing Data in Objects Rob Miles Department of Computer Science 28d 08120 Programming 2 Objects and Items I have said for some time that you use objects to represent things in your problem Objects equate
More informationUNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED
UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2019 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation
More informationCPS122 Lecture: Defining a Class
Objectives: CPS122 Lecture: Defining a Class last revised January 14, 2016 1. To introduce structure of a Java class 2. To introduce the different kinds of Java variables (instance, class, parameter, local)
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation
More informationJava Puzzle Ball MOOC Lab 4: Lambda Expressions
www.oracle.com/java www.oracle.com/oll Java Puzzle Ball MOOC Lab 4: Lambda Expressions Overview Lambda expressions facilitate functional programming. They enable logic and functionality to be stored as
More informationSTUDENT LESSON A5 Designing and Using Classes
STUDENT LESSON A5 Designing and Using Classes 1 STUDENT LESSON A5 Designing and Using Classes INTRODUCTION: This lesson discusses how to design your own classes. This can be the most challenging part of
More informationReview. these are the instance variables. these are parameters to the methods
Review Design a class to simulate a bank account Implement the class Write a demo program that creates bank accounts Write junit tests for the bank account class Review What data items are associated with
More informationProgramming a Bank Database. We ll store the information in two tables: INTEGER DECIMAL(10, 2)
WE1 W o r k e d E x a m p l e 2 2.1 Programming a Bank Database In this Worked Example, we will develop a complete database program. We will reimplement the ATM simulation of Chapter 12, storing the customer
More informationHandout 8 Classes and Objects Continued: Static Variables and Constants.
Handout 8 CS603 Object-Oriented Programming Fall 16 Page 1 of 8 Handout 8 Classes and Objects Continued: Static Variables and Constants. 1. Static variable Declared with keyword static One per class (instead
More informationDefensive Programming
Defensive Programming Software Engineering CITS1220 Based on the Java1200 Lecture notes by Gordon Royle Lecture Outline Why program defensively? Encapsulation Access Restrictions Documentation Unchecked
More informationIntro to Computer Science 2. Inheritance
Intro to Computer Science 2 Inheritance Admin Questions? Quizzes Midterm Exam Announcement Inheritance Inheritance Specializing a class Inheritance Just as In science we have inheritance and specialization
More informationCHAPTER 10 INHERITANCE
CHAPTER 10 INHERITANCE Inheritance Inheritance: extend classes by adding or redefining methods, and adding instance fields Example: Savings account = bank account with interest class SavingsAccount extends
More informationThe Object Oriented Paradigm
The Object Oriented Paradigm Joseph Spring 7COM1023 Programming Paradigms 1 Discussion The OO Paradigm Procedural Abstraction Abstract Data Types Constructors, Methods, Accessors and Mutators Coupling
More informationCreating and Using Objects
Creating and Using Objects 1 Fill in the blanks Object behaviour is described by, and object state is described by. Fill in the blanks Object behaviour is described by methods, and object state is described
More informationclass declaration Designing Classes part 2 Getting to know classes so far Review Next: 3/18/13 Driver classes:
Designing Classes part 2 CSC 1051 Data Structures and Algorithms I Getting to know classes so far Predefined classes from the Java API. Defining classes of our own: Driver classes: Account Transactions
More information2/9/2012. Chapter Three: Implementing Classes. Chapter Goals
Chapter Three: Implementing Classes Chapter Goals To become familiar with the process of implementing classes To be able to implement simple methods To understand the purpose and use of constructors To
More informationClass 09 Slides: Polymorphism Preconditions. Table of Contents. Postconditions
Class 09 Slides: Polymorphism Preconditions Students are familiar with inheritance and arrays. Students have worked with a poorly written program in A08 that could benefit from polymorphism. Students have
More information9/2/2011. Chapter Goals
Chapter Goals To become familiar with the process of implementing classes To be able to implement simple methods To understand the purpose and use of constructors To understand how to access instance fields
More informationCmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects
CmSc 150 Fundamentals of Computing I Lesson 28: Introduction to Classes and Objects in Java 1. Classes and Objects True object-oriented programming is based on defining classes that represent objects with
More informationImplementation. (Mapping to Java) Jörg Kienzle & Alfred Strohmeier. COMP-533 Implementation
Implementation (Mapping to Java) Jörg Kienzle & Alfred Strohmeier COMP-533 Implementation Datatype Enumeration Class Attribute Association Inheritance Method Visibility Collections Overview 2 Data Type
More informationAnatomy of a Class Encapsulation Anatomy of a Method
Writing Classes Writing Classes We've been using predefined classes. Now we will learn to write our own classes to define objects Chapter 4 focuses on: class definitions instance data encapsulation and
More informationJava Puzzle Ball Nick Ristuccia
Java Puzzle Ball Nick Ristuccia Lesson 4-3 Editing Java Code Lab 4: Finish the Banking GUI Application The Lab Instructions are available on the Lesson 4 page of the MOOC. This is an enhanced version of
More informationObject oriented programming
Exercises 7 Version 1.0, 11 April, 2017 Table of Contents 1. Inheritance.................................................................. 1 1.1. Tennis Player...........................................................
More informationObject-Oriented Analysis, Design and Implementation. Case Study Part II
Object-Oriented Analysis, Design and Implementation Case Study Part II Assoc. Prof. Marenglen Biba MSc in Computer Science, UoG-UNYT Foundation Programme (C) 2010 Pearson Education, Inc. All 3-1 Further
More informationDesigning Classes. Where do objects come from? Where do objects come from? Example: Account datatype. Dr. Papalaskari 1
Designing Classes Where do objects come from? 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/
More informationJava Persistence API (JPA) Entities
Java Persistence API (JPA) Entities JPA Entities JPA Entity is simple (POJO) Java class satisfying requirements of JavaBeans specification Setters and getters must conform to strict form Every entity must
More informationSpring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques
1 CPSC2620 Advanced Programming Spring 2003 Instructor: Dr. Shahadat Hossain 2 Today s Agenda Administrative Matters Course Information Introduction to Programming Techniques 3 Course Assessment Lectures:
More informationChapter Goals. Chapter 9 Inheritance. Inheritance Hierarchies. Inheritance Hierarchies. Set of classes can form an inheritance hierarchy
Chapter Goals To learn about inheritance To understand how to inherit and override superclass methods To be able to invoke superclass constructors To learn about protected and package access control To
More informationSWC test question #01. Using objects part I
SWC test question #01 Using objects part I Using objects part I Give a presentation of the concept objects, and how you use objects You could describe Types Variables Variable definitions The assignment
More informationCSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University
Designing Classes 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/ Where do objects
More informationBasic Object-Oriented Concepts. 5-Oct-17
Basic Object-Oriented Concepts 5-Oct-17 Concept: An object has behaviors In old style programming, you had: data, which was completely passive functions, which could manipulate any data An object contains
More informationWhere do objects come from? Good question!
Designing Classes 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/ Where do objects
More informationCSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University
Designing Classes 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/ Where do objects
More informationEduardo M. Breijo Baullosa May 2, Assignment 17. Report
Eduardo M. Breijo Baullosa May 2, 2012 Cesar I. Cruz ICOM4015 Assignment 17 Report The Automated teller machine is a computer that allows the interaction between bank account information and its respective
More informationProgramming Abstractions
Programming Abstractions C S 1 0 6 B Cynthia Lee Topics du Jour: Make your own classes! Needed for Boggle assignment! We are starting to see a little bit in MarbleBoard assignment as well 2 Classes in
More informationUnderstanding class definitions
Objects First With Java A Practical Introduction Using BlueJ Understanding class definitions Looking inside classes 2.1 Looking inside classes basic elements of class definitions fields constructors methods
More information1st Semester MTCE 601A COMPUTER SYSTEM SOFTWARE
1st Semester MTCE 601A COMPUTER SYSTEM SOFTWARE LECTURE-1 Syllabus Introduction 1.1 Introduction to Object Oriented 1.2 Introduction to UML 1.3 Software Process and OOA&D 1.4 Component and CBSD 1.5 Patterns
More informationUnit3: Java in the large. Prepared by: Dr. Abdallah Mohamed, AOU-KW
Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 1. Introduction 2. Objects and classes 3. Information hiding 4. Constructors 5. Some examples of Java classes 6. Inheritance revisited 7. The class hierarchy
More informationLast lecture. Lecture 9. in a nutshell. in a nutshell 2. Example of encapsulation. Example of encapsulation. Class test. Procedural Programming
1 Lecture 9 Last lecture Class test Has been marked Collect your marks at your next seminar Seminars There are seminars this week to go through the class test Meet in the classroom indicated on the timetable
More informationInheritance Advanced Programming ICOM 4015 Lecture 11 Reading: Java Concepts Chapter 13
Inheritance Advanced Programming ICOM 4015 Lecture 11 Reading: Java Concepts Chapter 13 Fall 2006 Adapted from Java Concepts Companion Slides 1 Chapter Goals To learn about inheritance To understand how
More informationDefining Classes and Methods
Defining Classes and Methods Chapter 5 Objects and References: Outline Variables of a Class Type Defining an equals Method for a Class Boolean-Valued Methods Parameters of a Class Type Variables of a Class
More informationCSCI-1200 Computer Science II Fall 2006 Lecture 23 C++ Inheritance and Polymorphism
CSCI-1200 Computer Science II Fall 2006 Lecture 23 C++ Inheritance and Polymorphism Review from Lecture 22 Added parent pointers to the TreeNode to implement increment and decrement operations on tree
More informationCS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class
CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount
More informationDesigning Classes part 2
Designing Classes part 2 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/ Getting
More informationLecture 20: Implementation () / 33
Lecture 20: Implementation 15.07.2013 () 15.07.2013 1 / 33 Contents Implementation Implementation Principles Example: Eight Queens by Refinement () 15.07.2013 2 / 33 Implementation Input: software architecture,
More informationInheritance (P1 2006/2007)
Inheritance (P1 2006/2007) Fernando Brito e Abreu (fba@di.fct.unl.pt) Universidade Nova de Lisboa (http://www.unl.pt) QUASAR Research Group (http://ctp.di.fct.unl.pt/quasar) Chapter Goals To learn about
More informationIntroduction to Objects. James Brucker
Introduction to Objects James Brucker What is an Object? An object is a program element that encapsulates both data and behavior. An object contains both data and methods that operate on the data. Objects
More informationWhat This Course Is About Design-by-Contract (DbC)
What This Course Is About Design-by-Contract (DbC) Readings: OOSC2 Chapter 11 EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG Focus is design Architecture: (many) inter-related modules Specification:
More informationpublic void creditaccount(string accountnumber, float amount) { this.accounts.get(accountnumber).credit(amount); }
package bank; //... public class Bank { private Map accounts; public Bank() { this.accounts = new HashMap(); public void addaccount(bankaccount account) { this.accounts.put(account.getnumber(),
More informationRecap of OO concepts. Objects, classes, methods and more. Mairead Meagher Dr. Siobhán Drohan. Produced by:
Recap of OO concepts Objects, classes, methods and more. Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Classes and Objects A class defines a
More informationIT 313 Advanced Application Development
Page 1 of 7 IT 313 Advanced Application Development Practice Midterm Exam Part A. Multiple Choice Questions. Answer all questions. Optional: supply a reason or show work for partial credit in case you
More informationHandout 9 OO Inheritance.
Handout 9 CS603 Object-Oriented Programming Fall 2016 Page 1 of 11 Handout 9 OO Inheritance. All classes in Java form a hierarchy. The top of the hierarchy is class Object Example: classicalarchives.com
More informationQuarter 1 Practice Exam
University of Chicago Laboratory Schools Advanced Placement Computer Science Quarter 1 Practice Exam Baker Franke 2005 APCS - 12/10/08 :: 1 of 8 1.) (10 percent) Write a segment of code that will produce
More informationCOMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli
COMS W3101 Programming Language: C++ (Fall 2015) ramana@cs.columbia.edu Lecture-3 Constructor and destructor review Data and Member functions review Data encapsulation public, private and protected members
More informationCSCI-1200 Data Structures Fall 2017 Lecture 25 C++ Inheritance and Polymorphism
SI-1200 ata Structures Fall 2017 Lecture 25 ++ Inheritance and Polymorphism Review from Lecture 24 (& Lab 12!) Finish hash table implementation: Iterators, find, insert, and erase asic data structures
More informationObjects and Classes. Lecture 10 of TDA 540 (Objektorienterad Programmering) Chalmers University of Technology Gothenburg University Fall 2017
Objects and Classes Lecture 10 of TDA 540 (Objektorienterad Programmering) Carlo A. Furia Alex Gerdes Chalmers University of Technology Gothenburg University Fall 2017 All labs have been published Descriptions
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 informationCatching Defects: Design or Implementation Phase? Design-by-Contract (Dbc) Test-Driven Development (TDD) Motivation of this Course
Design-by-Contract (Dbc) Test-Driven Development (TDD) Readings: OOSC2 Chapter 11 Catching Defects: Design or Implementation Phase? To minimize development costs, minimize software defects. The cost of
More informationFive EASY Steps to Switch to
Five EASY Steps to Switch to Peoples Bank & Trust Company It s easy to switch your accounts to Peoples Bank & Trust Company because we ll help. We ll provide the forms and a check list of simple things
More information/** * finds the index of v in a if present * * * * */ public static int findinsortedarray(int[] a, int v) {...
1 2 /** * finds the index of v in a if present * * @pre??? * * @post??? * * */ public static int findinsortedarray(int[] a, int v) {... } 3 /** * finds the index of v in a if present * * @pre a[i] < a[i+1]
More informationLecture Chapter 2 Software Development
Lecture Chapter 2 Software Development Large Software Projects Software Design o Team of programmers o Cost effective development Organization Communication Problem Solving Analysis of the problem Multiple
More informationCS 1302 Chapter 9 (Review) Object & Classes
CS 1302 Chapter 9 (Review) Object & Classes Reference Sections 9.2-9.5, 9.7-9.14 9.2 Defining Classes for Objects 1. A class is a blueprint (or template) for creating objects. A class defines the state
More informationObject-Oriented Programming (Java)
Object-Oriented Programming (Java) Topics Covered Today 2.1 Implementing Classes 2.1.1 Defining Classes 2.1.2 Inheritance 2.1.3 Method equals and Method tostring 2 Define Classes class classname extends
More informationHow to be a Good Bean
How to be a Good Bean A JavaBeans component, or simply a Bean, is a reusable software component that can be manipulated visually in a builder tool. The JavaBeans 1.0 architecture specifies how a JavaBeans
More informationLesson 10B Class Design. By John B. Owen All rights reserved 2011, revised 2014
Lesson 10B Class Design By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Encapsulation Inheritance and Composition is a vs has a Polymorphism Information Hiding Public
More informationENGR 2710U Midterm Exam UOIT SOLUTION SHEET
SOLUTION SHEET ENGR 2710U: Object Oriented Programming & Design Midterm Exam October 19, 2012, Duration: 80 Minutes (9 Pages, 14 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Name: Student Number:
More informationBuilding Your Own Classes
COMP-202 Building Your Own Classes Lecture Outline Anatomy of a Class Methods Method Kinds Method Signature Method Invocation Method Body Parameter Passing The Bank Application Example Instance Data public
More informationClasses. Classes as Code Libraries. Classes as Data Structures. Classes/Objects/Interfaces (Savitch, Various Chapters)
Classes Classes/Objects/Interfaces (Savitch, Various Chapters) TOPICS Classes Public versus Private Static Data Static Methods Interfaces Classes are the basis of object-oriented (OO) programming. They
More informationCS1004: Intro to CS in Java, Spring 2005
CS1004: Intro to CS in Java, Spring 2005 Lecture #13: Java OO cont d. Janak J Parekh janak@cs.columbia.edu Administrivia Homework due next week Problem #2 revisited Constructors, revisited Remember: a
More informationWelcome1.java // Fig. 2.1: Welcome1.java // Text-printing program.
1 Welcome1.java // Fig. 2.1: Welcome1.java // Text-printing program. public class Welcome1 // main method begins execution of Java application System.out.println( "Welcome to Java Programming!" ); } //
More informationCMSC 202. Exceptions
CMSC 202 Exceptions Error Handling In the ideal world, all errors would occur when your code is compiled. That won t happen. Errors which occur when your code is running must be handled by some mechanism
More information(a) Write the signature (visibility, name, parameters, types) of the method(s) required
1. (6 pts) Is the final comprehensive? 1 2. (6 pts) Java has interfaces Comparable and Comparator. As discussed in class, what is the main advantage of Comparator? 3. (6 pts) We can use a comparator in
More informationCOMP 401 Spring 2014 Midterm 1
COMP 401 Spring 2014 Midterm 1 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page
More informationMSc/ICY Software Workshop Exception Handling, Assertions Scanner, Patterns File Input/Output
MSc/ICY Software Workshop Exception Handling, Assertions Scanner, Patterns File Input/Output Manfred Kerber www.cs.bham.ac.uk/~mmk 21 October 2015 1 / 18 Manfred Kerber Classes and Objects The information
More informationChapter 15 Chapter 11
Chapter 15 Chapter 11 /** * Deposit money into the account * @param amount The amount to be deposited * * @pre true * @post IF amount >= 0 * THEN getbalance() = @pre.getbalance() + amount * ELSE getbalance()
More informationOBJECTS AND CLASSES CHAPTER. Final Draft 10/30/2011. Slides by Donald W. Smith TechNeTrain.com
CHAPTER 8 OBJECTS AND CLASSES Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/2011 Chapter Goals To understand the concepts of classes, objects and encapsulation To implement instance variables,
More informationChapter 10 Inheritance. Big Java by Cay Horstmann Copyright 2009 by John Wiley & Sons. All rights reserved.
Chapter 10 Inheritance Chapter Goals To learn about inheritance To understand how to inherit and override superclass methods To be able to invoke superclass constructors To learn about protected and package
More informationObjects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes
Based on Introduction to Java Programming, Y. Daniel Liang, Brief Version, 10/E 1 Creating Classes and Objects Classes give us a way of defining custom data types and associating data with operations on
More information