Abstract Data Types (ADTs) Basic Elements of an ADT. Translating an ADT into Code. Problem Magic! Solution. Class #26: Abstract Data Types. Data.

Size: px
Start display at page:

Download "Abstract Data Types (ADTs) Basic Elements of an ADT. Translating an ADT into Code. Problem Magic! Solution. Class #26: Abstract Data Types. Data."

Transcription

1 Abstract Data Types (ADTs) Problem Magic! Solution Class #26: Abstract Data Types Software Design II (CS 220): M. Allen, 11 March 16! An ADT is like a sketch of a solution to a problem! The basic elements we need to solve the problem, without any unnecessary detail! Sometimes, this can require us to do a lot of work to fill it in Friday, 11 Mar. 2016" Software Design II (CS 220)" 2" Basic Elements of an ADT! We can start by breaking down the problem into its simple main components 1. Data: the information we need to keep track of 2. Operations: what we can do with that information! Only once we understand the basic elements of the type we want to use, can we begin properly implementing it Data Operations Friday, 11 Mar. 2016" Software Design II (CS 220)" 3" Translating an ADT into Code! Once we have our general picture, we make it more and more specific, until we finally turn it into actual code 1. ADT" Data Operations 2. Class Diagram" myclass! + int var1! + int method()! + void method2(int i)! 3. Class Specification"! public void method2(int j)! Description of what method2 actually does (preconditions, output, etc.)! public class myclass! Friday, 11 Mar. 2016" Software Design II (CS 220)" 4" 4. Java Class Code" // code! 1

2 Template-Based Design! When solving a design problem, it often helps to create a template! Isolate the basic elements we will need! Create slots for those elements in our design! Fill in the slots later, to create a particular item Template-Based Design in Java! Inheritance provides one basic mechanism for templates! We create a super-class with all the basic features we want! Every sub-class that inherits from the super-class will have those features! While this works for any class, some types are only meant to be inherited! Abstract classes! Interfaces TemplateClass SomeSubclass Friday, 11 Mar. 2016" Software Design II (CS 220)" 5" Friday, 11 Mar. 2016" Software Design II (CS 220)" 6" Abstract Classes! An abstract class creates a pattern for other classes! Must be inherited (cannot be instantiated on its own)! Can be partially specified (abstract methods must be over-ridden by children) Vehicle {abstract + void setmileage( int )! protected instance variables (to be inherited) Normal methods (to be specified in Vehicle class) abstract methods (must be specified in child classes) Friday, 11 Mar. 2016" Software Design II (CS 220)" 7" Coding Abstract Classes Vehicle {abstract public abstract class Vehicle protected int mileage;! protected String makemodel;! // generic constructor! public Vehicle() mileage = 0;! makemodel = "Generic Vehicle";! // set/get methods! public void setmileage( int i ) {! mileage = i;! public void setmakemodel( String s ) {! makemodel = s;! public int getmileage() {! return mileage;! public String getmakemodel() {! return makemodel;! // abstract method (must be over-ridden)! public abstract String getinfo();! Friday, 11 Mar. 2016" Software Design II (CS 220)" 8" 2

3 Abstract Class Constructors! An abstract class will have a constructor, as usual // generic constructor! public Vehicle() mileage = 0;! makemodel = "Generic Vehicle";!! Such objects cannot be instantiated, however!! The following code will not compile: Vehicle v = new Vehicle();! Generates error message:! Vehicle is abstract; cannot be instantiated! Friday, 11 Mar. 2016" Software Design II (CS 220)" 9"! To be used, an abstract class must be extended Vehicle {abstract Child class must over-ride the abstract methods Friday, 11 Mar. 2016" Software Design II (CS 220)" 10" public class Car extends Vehicle! // constructor! public Car( String s ) // returns info about Car as String! // (over-ridden abstract method)! public String getinfo() String info = "This Car is a " + makemodel;!! As when we extend a normal class, we don t have to override complete methods that we want to use directly from Vehicle!! We only need to ensure our new class can actually be constructed, and has filled in any abstract methods that weren t fully complete Child class has its own (actually useable) constructor method Child class over-rides all of the abstract methods with its own suitable code Friday, 11 Mar. 2016" Software Design II (CS 220)" 11"! Again, like a regular class, we can extend an abstract class in multiple different ways Vehicle {abstract Truck! - int capacity! + Truck( String, int )! Friday, 11 Mar. 2016" Software Design II (CS 220)" 12" 3

4 public class Car extends Vehicle public Car( String s ) public String getinfo() String info = "This Car is a " + makemodel;! public class Truck extends Vehicle private int capacity;! public Truck( String s, int cap ) capacity = cap;! Each child class extends the same abstract parent template class Each child class then must over-ride all abstract methods in its own way public String getinfo() String info = "This Truck is a " + makemodel;! info += ", and carrying capacity of " + capacity + " tons";! Friday, 11 Mar. 2016" Software Design II (CS 220)" 13" public void filllot()! Vehicle[] vehicles = new Vehicle[10];! Polymorphism & Abstraction for (int i = 0; i < vehicles.length; i++)! if (i % 2 == 0)! vehicles[i] = new Car( "Honda Element );! else! vehicles[i] = new Truck("Ford Ranger, 2);! printinfo( vehicles );! private void printinfo( Vehicle[] vehicles )! for (int i = 0; i < vehicles.length; i++)! System.out.println( i + ". " + vehicles[i].getinfo() );! This array has an abstract type (so it can store multiple types of actual class object references) We fill it with references to objects of a non-abstract (normal) type Calling getinfo() works for both child types, using version from the actual class type each time Friday, 11 Mar. 2016" Software Design II (CS 220)" 14" Abstract Classes in the Java Libraries! Java already contains many abstract classes! For example, the hierarchy we have seen before: java.lang.object! java.awt.component! java.lang.container! javax.swing.jcomponent! These are regular classes These are abstract classes Abstract Classes in the Java Libraries javax.swing.jcomponent! Square!! JComponent is an interesting example: it is declared to be abstract, but it contains no abstract methods! Instead, this is just so that we have a certain amount of basic functionality that we can extend and inherit! Since a JComponent is just an invisible box for holding graphics, there is no reason to use it on its own! Thus, its programmers simply made it abstract, so that users would (we assume) write in code to make it do something a little more interesting when they extended it Friday, 11 Mar. 2016" Software Design II (CS 220)" 15" Friday, 11 Mar. 2016" Software Design II (CS 220)" 16" 4

5 Enjoy Your Spring Break! Please Do!! Reading: Chapter 06 due Monday 21 March Friday, 11 Mar. 2016" Software Design II (CS 220)" 17" 5

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 04 / 06 / 2015 Instructor: Michael Eckmann Today s Topics Comments and/or Questions? Let's finish Pet/Dog/Cat/TalkingDog classes Overriding methods Abstract New

More information

CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.

CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship. CSCI 253 Object Oriented Design: Java Review OOP George Blankenship George Blankenship 1 Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation Abstract Data Type (ADT) Implementation

More information

Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT

Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT BSc (Hons) in Computer Applications, BSc (Hons) Computer Science with Network Security, BSc (Hons) Business Information Systems & BSc (Hons) Software Engineering Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT

More information

(e) none of the above.

(e) none of the above. 1 The default value of a static integer variable of a class in Java is, (a) 0 (b) 1 (c) Garbage value (d) Null (e) -1 2 What will be printed as the output of the following program? public class testincr

More information

Agenda. What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism

Agenda. What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism Polymorphism 1 Agenda What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism 2 What is & Why Polymorphism? 3 What is Polymorphism? Generally, polymorphism refers

More information

Lecture Notes on Programming Languages

Lecture Notes on Programming Languages Lecture Notes on Programming Languages 1 Lecture 09: Support for Object-Oriented Programming This lecture discusses how programming languages support object-oriented programming. Topics to be covered include:

More information

Implementation Inheritance

Implementation Inheritance Implementation Inheritance Computer Science and Engineering College of Engineering The Ohio State University Lecture 12 Recall: Interface Inheritance void select (Person p) { //declared type of p is: //dynamic

More information

Java Programming Language

Java Programming Language Lecture 1 Part II Java Programming Language Additional Features and Constructs Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Subclasses and

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

CS 335 Java Programming Inheritance

CS 335 Java Programming Inheritance CS 335 Java Programming Inheritance Java: Object-Oriented Programming Inheritance: superclasses and subclasses Polymorphism: abstract and concrete classes Dynamic binding Multiple inheritance via Interfaces

More information

COMP1008 Inheritance. Outline. Subclass and Superclass. Inheritance. Multiple Subclasses. Inheritance Hierarchy

COMP1008 Inheritance. Outline. Subclass and Superclass. Inheritance. Multiple Subclasses. Inheritance Hierarchy Outline COMP1008 Inheritance Introduction to inheritance. How Java supports inheritance. Inheritance is a key feature of object-oriented programming. 2 Inheritance Subclass and Superclass Models the kind-of

More information

Chapter 12. Support for. Oi t Programming

Chapter 12. Support for. Oi t Programming Chapter 12 Support for Object-Oriented Oi t Programming Chapter 12 Topics Introduction Object-Oriented Programming Design Issues for Object-Oriented Languages Support for Object-Oriented Programming g

More information

Methods and Inheritance: Overriding

Methods and Inheritance: Overriding Methods and Inheritance: Overriding We might want to require that every Person can dance. But the way a Lecturer dances is not likely to be the same as the way a Student dances... Student overrides the

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

CS 111 Classes I 1. Software Organization View to this point:

CS 111 Classes I 1. Software Organization View to this point: CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects

More information

CSCU9T4: Object Modelling, principles of OO design and implementation

CSCU9T4: Object Modelling, principles of OO design and implementation CSCU9T4: Object Modelling, principles of OO design and implementation CSCU9T4 Spring 2016 1 What is Inheritance? Why use Inheritance? Discussion CSCU9T4 Spring 2016 2 Inheritance In inheritance, a subclass

More information

Computing Concepts with Java Essentials

Computing Concepts with Java Essentials 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards Course Title: TeenCoder: Java Programming Course ISBN: 978 0 9887070 2 3 Course Year: 2015 Note: Citation(s) listed may represent

More information

Polymorphism II CMSC 202

Polymorphism II CMSC 202 Polymorphism II CMSC 202 Topics Constructors and polymorphism The clone method Abstract methods Abstract classes 10/2010 2 Constructors and Polymorphism A constructor for the base class is automatically

More information

SL-110: Fundamentals of Java Revision 15 October Sun Educational Services Instructor-Led Course Description

SL-110: Fundamentals of Java Revision 15 October Sun Educational Services Instructor-Led Course Description Sun Educational Services Instructor-Led Course Description Fundamentals of Java SL-110 The Fundamentals of the Java course provides students, with little or no programming experience, with the basics of

More information

a. Inheritance b. Abstraction 1. Explain the following OOPS concepts with an example

a. Inheritance b. Abstraction 1. Explain the following OOPS concepts with an example 1. Explain the following OOPS concepts with an example a. Inheritance It is the ability to create new classes that contain all the methods and properties of a parent class and additional methods and properties.

More information

Selenium Online Course - Smart Mind Online Training, Hyderabad. Selenium Online Training Course Content

Selenium Online Course - Smart Mind Online Training, Hyderabad. Selenium Online Training Course Content Selenium Online Training Course Content Faculty: Real time and certified (Includes theoretical as well as practical sessions) Introduction to Automation What is automation testing Advantages of Automation

More information

Basic Concepts. Objects. Chapter

Basic Concepts. Objects. Chapter Chapter 1 Basic Concepts In traditional programming, we start with a problem to solve. We figure out how to break the problem into smaller parts, then each part into smaller parts still. At each stage

More information

Introduction to Java A First Look

Introduction to Java A First Look Introduction to Java A First Look Java is a second or third generation object language Integrates many of best features Smalltalk C++ Like Smalltalk Everything is an object Interpreted or just in time

More information

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition Java 6 'th edition Concepts INTERNATIONAL STUDENT VERSION CONTENTS PREFACE vii SPECIAL FEATURES xxviii chapter i INTRODUCTION 1 1.1 What Is Programming? 2 J.2 The Anatomy of a Computer 3 1.3 Translating

More information

CIS 190: C/C++ Programming. Polymorphism

CIS 190: C/C++ Programming. Polymorphism CIS 190: C/C++ Programming Polymorphism Outline Review of Inheritance Polymorphism Car Example Virtual Functions Virtual Function Types Virtual Table Pointers Virtual Constructors/Destructors Review of

More information

10266A: Programming in C# with Microsoft Visual Studio 2010

10266A: Programming in C# with Microsoft Visual Studio 2010 10266A: Programming in C# with Microsoft Visual Studio 2010 Course Overview The course focuses on the C# program structure, language syntax, and implementation details with.net Framework 4.0. This course

More information

Course: Introduction to Java Using Eclipse Training

Course: Introduction to Java Using Eclipse Training Course: Introduction to Java Using Eclipse Training Course Length: Duration: 5 days Course Code: WA1278 DESCRIPTION: This course introduces the Java programming language and how to develop Java applications

More information

Topic Java Class. Library INTRODUCTION LEARNING OUTCOMES. By the end of this topic, you should be able to:

Topic Java Class. Library INTRODUCTION LEARNING OUTCOMES. By the end of this topic, you should be able to: Topic Java Class Library 8 LEARNING OUTCOMES By the end of this topic, you should be able to: 1. Describe the meaning of package in Java; 2. Describe the purpose of keyword import; 3. Describe of how classes

More information

History OOP languages Year Language 1967 Simula-67 1983 Smalltalk

History OOP languages Year Language 1967 Simula-67 1983 Smalltalk History OOP languages Intro 1 Year Language reported dates vary for some languages... design Vs delievered 1957 Fortran High level programming language 1958 Lisp 1959 Cobol 1960 Algol Structured Programming

More information

The Interface Concept

The Interface Concept Multiple inheritance Interfaces Four often used Java interfaces Iterator Cloneable Serializable Comparable The Interface Concept OOP: The Interface Concept 1 Multiple Inheritance, Example Person name()

More information

C++ Introduction to class and data abstraction

C++ Introduction to class and data abstraction C++ Introduction to class and data abstraction 1 Data abstraction A data abstraction is a simplified view of an object by specifying what can be done with the object while hiding unnecessary details In

More information

CS193j, Stanford Handout #10 OOP 3

CS193j, Stanford Handout #10 OOP 3 CS193j, Stanford Handout #10 Summer, 2003 Manu Kumar OOP 3 Abstract Superclass Factor Common Code Up Several related classes with overlapping code Factor common code up into a common superclass Examples

More information

RenderCAD S.r.l. Formazione

RenderCAD S.r.l. Formazione Descrizione This course teaches participants how to develop Java programs. The course focuses on teaching the core Java language (J2SE), including essential object-oriented principles. In addition to Java,

More information

Chapter 12. Support for Object-Oriented Programming ISBN

Chapter 12. Support for Object-Oriented Programming ISBN Chapter 12 Support for Object-Oriented Programming ISBN 0-321-33025-0 Chapter 12 Topics Introduction Object-Oriented Programming Design Issues for Object-Oriented Languages Support for Object-Oriented

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

Object Oriented Programming (Interview Questions & Answers)

Object Oriented Programming (Interview Questions & Answers) Object Oriented Programming (Interview Questions & Answers) Collected from different websites. Use for non-commercial purpose. Sohail Basheer Lecturer- Computer Science (visiting) Department of Computer

More information

PHP Object Oriented Classes and objects

PHP Object Oriented Classes and objects Web Development II Department of Software and Computing Systems PHP Object Oriented Classes and objects Sergio Luján Mora Jaume Aragonés Ferrero Department of Software and Computing Systems DLSI - Universidad

More information

Part I. Multiple Choice Questions (2 points each):

Part I. Multiple Choice Questions (2 points each): Part I. Multiple Choice Questions (2 points each): 1. Which of the following is NOT a key component of object oriented programming? (a) Inheritance (b) Encapsulation (c) Polymorphism (d) Parallelism ******

More information

Chapter 1 Fundamentals of Java Programming

Chapter 1 Fundamentals of Java Programming Chapter 1 Fundamentals of Java Programming Computers and Computer Programming Writing and Executing a Java Program Elements of a Java Program Features of Java Accessing the Classes and Class Members The

More information

c) Comments are areas of text ignored by the Java compiler.

c) Comments are areas of text ignored by the Java compiler. 1) Java applications a) A java application has a special method, called the main method, which is where the program will start. i) Each class can only have one main method. ii) You can tell eclipse which

More information

Yosemite National Park, California. CSE 114 Computer Science I Inheritance

Yosemite National Park, California. CSE 114 Computer Science I Inheritance Yosemite National Park, California CSE 114 Computer Science I Inheritance Containment A class contains another class if it instantiates an object of that class HAS-A also called aggregation PairOfDice

More information

Description of Class Mutation Mutation Operators for Java

Description of Class Mutation Mutation Operators for Java Description of Class Mutation Mutation Operators for Java Yu-Seung Ma Electronics and Telecommunications Research Institute, Korea ysma@etri.re.kr Jeff Offutt Software Engineering George Mason University

More information

22C:22 (CS:2820) Object-Oriented Software Development

22C:22 (CS:2820) Object-Oriented Software Development The University of Iowa 22C:22 (CS:2820) Object-Oriented Software Development Fall 2012 The Object Model by Cesare Tinelli The Object Model of Development Built on the best ideas from previous technologies

More information

STUDENT LESSON A11 Inheritance

STUDENT LESSON A11 Inheritance STUDENT LESSON A11 Inheritance Java Curriculum for AP Computer Science, Student Lesson A11 1 STUDENT LESSON A11 Inheritance INTRODUCTION: Inheritance, a major component of OOP, is a technique that will

More information

public abstract class Shape {

public abstract class Shape { Whenever a Rectangle, Oval, or RoundRect object has to draw itself, it is the redraw() method in the appropriate class that is executed. This leaves open the question, What does the redraw() method in

More information

Outline. Inheritance. Abstract Classes Interfaces. Class Extension Overriding Methods Inheritance and Constructors Polymorphism.

Outline. Inheritance. Abstract Classes Interfaces. Class Extension Overriding Methods Inheritance and Constructors Polymorphism. Outline Inheritance Class Extension Overriding Methods Inheritance and Constructors Polymorphism Abstract Classes Interfaces 1 OOP Principles Encapsulation Methods and data are combined in classes Not

More information

LAB4 Making Classes and Objects

LAB4 Making Classes and Objects LAB4 Making Classes and Objects Objective The main objective of this lab is class creation, how its constructer creation, object creation and instantiation of objects. We will use the definition pane to

More information

Grundlæggende Programmering IT-C, Forår 2001. Model solutions to. Written exam in Introductory Programming

Grundlæggende Programmering IT-C, Forår 2001. Model solutions to. Written exam in Introductory Programming Question 1 Question 1.1 The program prints the following four lines: 8 14 18 2 Question 1.2 The program prints the following six lines: 2 7 16 Question 1.3 The problem is solved using two for-loops: static

More information

Lab 3: Interfaces and Polymorphism

Lab 3: Interfaces and Polymorphism Lab 3: Interfaces and Polymorphism We've had four weeks of CS15 and by now, the buzzwords of Object-Oriented Programming (OOP) may be familiar to you. OOP is an extremely powerful and quickly growing modeling

More information

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75 Preet raj Core Java and Databases CS4PR Time Allotted: 3 Hours Final Exam: Total Possible Points 75 Q1. What is difference between overloading and overriding? 10 points a) In overloading, there is a relationship

More information

ATM Case Study OBJECTIVES. 2005 Pearson Education, Inc. All rights reserved. 2005 Pearson Education, Inc. All rights reserved.

ATM Case Study OBJECTIVES. 2005 Pearson Education, Inc. All rights reserved. 2005 Pearson Education, Inc. All rights reserved. 1 ATM Case Study 2 OBJECTIVES.. 3 2 Requirements 2.9 (Optional) Software Engineering Case Study: Examining the Requirements Document 4 Object-oriented design (OOD) process using UML Chapters 3 to 8, 10

More information

SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin

SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin SE 360 Advances in Software Development Object Oriented Development in Java Polymorphism Dr. Senem Kumova Metin Modified lecture notes of Dr. Hüseyin Akcan Inheritance Object oriented programming languages

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Grundlæggende Programmering IT-C, Forår 2001. Written exam in Introductory Programming

Grundlæggende Programmering IT-C, Forår 2001. Written exam in Introductory Programming Written exam in Introductory Programming IT University of Copenhagen, June 11, 2001 English version All materials are permitted during the exam, except computers. The exam questions must be answered in

More information

Some containers are called linear because their content (items) are stored in a single row (line). the rungs of a ladder

Some containers are called linear because their content (items) are stored in a single row (line). the rungs of a ladder Some containers are called linear because their content (items) are stored in a single row (line). Which of the following are linear? the rungs of a ladder the links in a chain the bricks in the wall of

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 9 Lecture 9-1: Inheritance reading: 9.1 The software crisis software engineering: The practice of developing, designing, documenting, testing large computer programs. Large-scale

More information

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

More information

Java 101 primer: Composition and inheritance. Use composition to overcome the problem with inheritance

Java 101 primer: Composition and inheritance. Use composition to overcome the problem with inheritance Java 101 primer: Composition and inheritance Use composition to overcome the problem with inheritance BY JEFF FRIESEN, JAVAWORLD, OCTOBER 2015 In Java 101: Inheritance in Java, Part 1, you learned how

More information

Extending Classes with Services

Extending Classes with Services Chapter 2 Extending Classes with Services Chapter Objectives After studying this chapter, you should be able to: Extend an existing class with new commands Explain how a message sent to an object is resolved

More information

Manual. Programmer's Guide for Java API

Manual. Programmer's Guide for Java API 2013-02-01 1 (15) Programmer's Guide for Java API Description This document describes how to develop Content Gateway services with Java API. TS1209243890 1.0 Company information TeliaSonera Finland Oyj

More information

243 Week 3 Lecture - Interfaces

243 Week 3 Lecture - Interfaces One problem, many solutions 243 Week 3 Lecture - Interfaces Suppose we want to implement a set of classes to represent various shapes such as circles and rectangles. We want to be able to calculate the

More information

Tutorial on Writing Modular Programs in Scala

Tutorial on Writing Modular Programs in Scala Tutorial on Writing Modular Programs in Scala Martin Odersky and Gilles Dubochet 13 September 2006 Tutorial on Writing Modular Programs in Scala Martin Odersky and Gilles Dubochet 1 of 45 Welcome to the

More information

Agile Software Development

Agile Software Development Agile Software Development Lecturer: Raman Ramsin Lecture 13 Refactoring Part 3 1 Dealing with Generalization: Pull Up Constructor Body Pull Up Constructor Body You have constructors on subclasses with

More information

Topic 4: Inheritance

Topic 4: Inheritance Topic 4: Inheritance Extending, Overriding and Final Jesper Pedersen Notander Department of Computer Science Lund University Faculty of Engineering Learning Scala Seminar 2 Contents Abstract and concrete

More information

CSC207 - Arrays, Inheritance, Generic Types

CSC207 - Arrays, Inheritance, Generic Types CSC207 - Arrays, Inheritance, Generic Types Ilir Dema Summer 2016 What is an array? An array is an arrangement of elements of the same type at equally spaced addresses in computer memory. Algonquin Radio

More information

Object Oriented System Development with VB.NET

Object Oriented System Development with VB.NET Chapter 1 Object Oriented System Development with Objectives In this chapter, you will: Learn about OO development and Understand object-oriented concepts Recognize the benefits of OO development Preview

More information

CS170 Lab 11 Abstract Data Types & Objects

CS170 Lab 11 Abstract Data Types & Objects CS170 Lab 11 Abstract Data Types & Objects Introduction: Abstract Data Type (ADT) An abstract data type is commonly known as a class of objects An abstract data type in a program is used to represent (the

More information

Introduction to Object-Oriented Programming

Introduction to Object-Oriented Programming Introduction to Object-Oriented Programming Objects and classes Abstract Data Types (ADT) Encapsulation and information hiding Aggregation Inheritance and polymorphism OOP: Introduction 1 Pure Object-Oriented

More information

Multiple Choice Questions (20 points)

Multiple Choice Questions (20 points) CSC142 Midterm 1 1 Multiple Choice Questions (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth

More information

Advanced Placement Computer Science. Main Tenants of OO Programming. Inheritance and Polymorphism. Nomenclature of Inheritance

Advanced Placement Computer Science. Main Tenants of OO Programming. Inheritance and Polymorphism. Nomenclature of Inheritance Advanced Placement Computer Science Inheritance and Polymorphism What s past is prologue. Don t write it twice write it once and reuse it. Bekki George James E. Taylor HS, Katy Main Tenants of OO Programming

More information

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1 The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose

More information

Object oriented programming. Lecture 13: Object orientation. Object oriented programming. Introduction. OO and ADT:s. Introduction

Object oriented programming. Lecture 13: Object orientation. Object oriented programming. Introduction. OO and ADT:s. Introduction Lecture 13: Object orientation Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO support in C++ and Java Object

More information

CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours:

CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours: CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Tuesday 10:00 AM 12:00 PM * Wednesday 4:00 PM 5:00 PM Friday 11:00 AM 12:00 PM OR

More information

Interfaces. Relatedness of types. The area and perimiter of shapes. Interface as a contract. Interfaces. Interfaces with abstract classes 3/29/13

Interfaces. Relatedness of types. The area and perimiter of shapes. Interface as a contract. Interfaces. Interfaces with abstract classes 3/29/13 Relatedness of types Interfaces Savitch ch. 8.4 Consider the task of writing classes to represent 2D shapes such as Circle, Rectangle, and Triangle. There are certain attributes or operations that are

More information

VU Mobile Powered by S NO Group All Rights Reserved S NO Group 2012

VU Mobile Powered by S NO Group All Rights Reserved S NO Group 2012 1 CS304 Final Term Solved MCQs Mega File (Latest All in One) User can make virtual table explicitly. True False In order to define a class template the first line of definition must be: template

More information

Projet Java. Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan)

Projet Java. Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan) Projet Java Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan) Objectives - Apprendre à programmer en Java - Travailler à plusieurs sur un gros projet qui a plusieurs aspects: graphisme, interface

More information

Keywords Compared in Various Languages

Keywords Compared in Various Languages Keywords Compared in Various Languages Visual Studio 2010 This topic lists common programming tasks that can be summarized with a language keyword. For more information about tasks that need code examples,

More information

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm

More information

Study on Function Ambiguity in Inheritance Using Object Oriented Programming with C++, Java and C#

Study on Function Ambiguity in Inheritance Using Object Oriented Programming with C++, Java and C# ISSN (Online): 2409-4285 www.ijcsse.org Page: 208-212 Study on Function Ambiguity in Inheritance Using Object Oriented Programming with C++, Java and C# MANOJ R CHAKRAVATHI Department of ISE NMIT, Bangalore,

More information

Selenium Online Training

Selenium Online Training Selenium Online Training IQ training facility offers Selenium Online Training. Our Selenium trainers come with vast work experience and teaching skills. Our Selenium training online is regarded as the

More information

Chapter 13 - Inheritance

Chapter 13 - Inheritance Goals Chapter 13 - Inheritance 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 information

Abstract Classes. Suppose we want write a program that manipulates various types of bank accounts. An Account typically has following features;

Abstract Classes. Suppose we want write a program that manipulates various types of bank accounts. An Account typically has following features; Abstract Classes Suppose we want write a program that manipulates various types of bank accounts. An Account typically has following features; Name, AccountNumber, Balance. Following operations can be

More information

Inheritance, overloading and overriding

Inheritance, overloading and overriding Inheritance, overloading and overriding Recall with inheritance the behavior and data associated with the child classes are always an extension of the behavior and data associated with the parent class

More information

AP Computer Science Homework Set 7 Inheritance

AP Computer Science Homework Set 7 Inheritance AP Computer Science Homework Set 7 Inheritance P7A. You ve been hired to design the next generation electronic device. Write the class definition for a new type of object of your own created design that

More information

Coding Standard for Java

Coding Standard for Java Coding Standard for Java 1. Content 1. Content 1 2. Introduction 1 3. Naming convention for Files/Packages 1 4. Naming convention for Classes, Interfaces, Members and Variables 2 5. File Layout (.java)

More information

Chapter 7. Inheritance. Inheritance Basics Programming with Inheritance Dynamic Binding and Polymorphism

Chapter 7. Inheritance. Inheritance Basics Programming with Inheritance Dynamic Binding and Polymorphism Chapter 7 Inheritance Inheritance Basics Programming with Inheritance Dynamic Binding and Polymorphism Chapter 7 Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Principles of

More information

Java Memory Management

Java Memory Management Java Memory Management 1 Tracing program execution Trace: To follow the course or trail of. When you need to find and fix a bug or have to understand a tricky piece of code that your coworker wrote, you

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game Directions: In mobile Applications the Control Model View model works to divide the work within an application.

More information

3 Pillars of Object-oriented Programming. Industrial Programming Systems Programming & Scripting. Extending the Example.

3 Pillars of Object-oriented Programming. Industrial Programming Systems Programming & Scripting. Extending the Example. Industrial Programming Systems Programming & Scripting Lecture 12: C# Revision 3 Pillars of Object-oriented Programming Encapsulation: each class should be selfcontained to localise changes. Realised through

More information

Stack Allocation. Run-Time Data Structures. Static Structures

Stack Allocation. Run-Time Data Structures. Static Structures Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,

More information

Specialized Programme on e-governance Application Development

Specialized Programme on e-governance Application Development Specialized Programme on e-governance Application Development A. NAME OF INSTITUTE B. NAME/TITLE OF THE COURSE C. COURSE DATES WITH DURATION IN WEEKS D. ELIGIBILITY CRITERIA FOR PARTICIPANTS: 1. EDUCATIONAL

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Summer Term 2015 Dr. Adrian Kacso, Univ. Siegen adriana.dkacsoa@duni-siegena.de Tel.: 0271/740-3966, Office: H-B 8406 State: June 17, 2015 Betriebssysteme / verteilte Systeme

More information

7.1 Our Current Model

7.1 Our Current Model Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.

More information

CSE 303 Concepts and Tools for Software Development. Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes)

CSE 303 Concepts and Tools for Software Development. Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes) CSE 303 Concepts and Tools for Software Development Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes) Where We Are We have already covered the introduction

More information

Data Abstraction and Object Orientation. CSE 307 Principles of Programming Languages Stony Brook University

Data Abstraction and Object Orientation. CSE 307 Principles of Programming Languages Stony Brook University Data Abstraction and Object Orientation CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Object-Oriented Programming Control or PROCESS abstraction

More information

C++FA 5.1 PRACTICE MID-TERM EXAM

C++FA 5.1 PRACTICE MID-TERM EXAM C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer

More information

Fundamentals of Java Programming

Fundamentals of Java Programming Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

More information