Assignment 4: Object creation
|
|
- Alexander Hall
- 5 years ago
- Views:
Transcription
1 Assignment 4: Object creation ETH Zurich Hand-out: 12 October 2007 Due: 19 October 2007 Copyright FarWorks, Inc. Gary Larson Goals Create objects in Traffic. Write a first stand-alone program. Create and use a new class. Learn about the basic input and output operations in Eiffel. Repeat the difference between strict and non-strict boolean operators. 1 Creating objects in Traffic Up to now you have always worked with existing, predefined objects of Paris. In this assignment you will create new objects and add them to Paris. To build new map objects in Traffic (be it passengers, trams, places, lines, roads, etc.) you can follow a general scheme: 1. Declare an attribute or local variable of the according type. This step is needed, so that the software knows that the identifier you will be using in the code is valid and what type of object it can denote. If you forget this step, the Eiffel compiler will produce an error saying that you are using an Unknown identifier. The declaration of a new attribute is always placed outside of other feature declarations, 1
2 but between the keyword feature (line 8 in Listing 1) and (line 21 in Listing 1) of the class text. It is composed of the identifier (name for the new object), a colon, and the type of it. In our example the identifier is place and the type is TRAFFIC PLACE. 2. Create the object using one of the creation procedures declared in the according class. If you forget this step, the declared identifier will be void and calling features on it will result in a program crash (displaying the message Feature call on Void target ). If you like you can set additional properties of the object. To detect the available creation procedures, look at the text of the class used in step 1. They are listed in the creation clause of the class header (see lines 17 and 18 of Listing 2). In our example a TRAFFIC PLACE can be created using either make or make with position as a creation procedure. make with position requires three arguments: a STRING object and two INTEGER objects. Note that for STRINGs there is a fast track to object creation: Just put the text you want in the STRING object between double quotation marks. For INTEGERs this fast track is done by writing the number at the appropriate position. 3. Add the object to the map by adding it to the according container. If you forget this step, there will be no compiler error and no program crash, but you won t see the object on the displayed map. The class TRAFFIC MAP provides several containers for the various types of map objects and for each there is a command that allows you to put a new object into the container. To make things easier, we list them here and show you for most map item types how they should be put into the according container: Example declaration Adding it to the map pl: TRAFFIC PLACE Paris.places.force (pl, pl.name) l: TRAFFIC LINE Paris.lines.force (l, l.name) r: TRAFFIC ROAD Paris.roads.force (r, r.id) pa: TRAFFIC PATH Paris.paths.put last (pa) bv: TRAFFIC VILLA Paris.buildings.put last (bv) ba: TRAFFIC APARTMENT BUILDING Paris.buildings.put last (ba) bl: TRAFFIC LANDMARK Paris.buildings.put last (bl) bs: TRAFFIC SKYSCRAPER Paris.buildings.put last (bs) te: TRAFFIC EVENT TAXI OFFICE Paris.taxi offices.put last (te) td: TRAFFIC DISPATCHER TAXI OFFICE Paris.taxi offices.put last (td) p: TRAFFIC PASSENGER Paris.passengers.put last (p) t: TRAFFIC TRAM Paris.trams.put last (t) b: TRAFFIC BUS Paris.busses.put last (b) f: TRAFFIC FREE MOVING Paris.free movings.put last (f) 1 class CREATION EXAMPLE 3 inherit 5 TOURISM 7 feature Explore Paris 9 explore on click is 11 Create a new place. do 13 Paris. display Listing 1: Creating a new TRAFFIC PLACE object 2
3 create place.make with position ( Home, 600, 700) Step 2: Creation of the new object 15 Paris.places. force (place, place.name) Step 3: Adding new object to the map 17 place : TRAFFIC PLACE Step 1: Declaration of attribute 19 New place 21 1 class TRAFFIC PLACE 3 inherit 5 HASHABLE redefine 7 out 9 TRAFFIC MAP ITEM 11 undefine out, 13 add to map, remove from map 15 Listing 2: Class TRAFFIC PLACE (shortened) 17 create make, make with position 19 feature {NONE} Initialize 21 make (a name: STRING) is 23 Initialize Current. require 25 a name exists: a name /= Void a name not empty: not a name.is empty 27 ensure name set: equal (a name, name) 29 position exists : position /= Void 31 make with position (a name: STRING; a x, a y: INTEGER) is 33 Initialize Current with name a name and position a x, a y. require 35 a name exists: a name /= Void a name not empty: not a name.is empty 37 ensure name set: equal (a name, name) 39 position exists : position /= Void position set : position.x = a x and position.y = a y feature Access 45 [... ] 47 To do 1. Before you start, please replace the file traffic/library/traffic line.e with the file provided at line.e, 3
4 and the file traffic/library/visualization/vision2/views/traffic vs view factory.e with the file provided at vs view factory.e. 2. Download 4.zip and extract it in traffic/example. You should now have a new directory traffic/example/ ev assignment 4 with assignment 4.ecf directly in it (it is important that the location corresponds to the description here!). 3. Open and compile this new project. Open class OBJECT CREATION and solve the tasks below in feature explore on click. 4. Create a new TRAFFIC PASSENGER that walks along Route1. Don t forget to call feature go on it (this will make it start moving). 5. Create four objects of type TRAFFIC TRAM. One should follow Line1, another Line2, yet another Line7 a, and the last one Line8. To make them start moving, call feature start on each of them. 6. Create four new TRAFFIC LANDMARKs with the following attributes and add them to the map: position image file (750, 700)../map/paris/notredame.png (120, 350)../map/paris/defense.png (800, 600)../map/paris/centrepompidou.png (300, 500)../map/paris/triomphe.png 7. For each of the landmarks, create a new TRAFFIC PLACE (plus additional places for the existing landmarks Louvre and Eiffel tower). Add them to the map and highlight them. Positions and names are given below: name position Notre Dame (750, 730) La Defense (120, 380) Centre Pompidou (800, 630) Arc de Triomphe (300, 540) Musee du Louvre (475, 650) Tour Eiffel (270, 840) 8. Create a new line of type TRAFFIC LINE. Make sure to use the creation procedure make with terminal, otherwise you will get a precondition violation when using the feature ext on it. The creation procedure has three arguments: the first one is the name of the new line, this should be Tourist line ; the second is the type of line, in our case this should be a bus line, so use an object of type TRAFFIC TYPE BUS as second argument; the third argument defines the starting place of the line, which in our case is the place with name La Defense (created in step 7). Use the feature ext to add the other five places created in step 7 as stops to the tourist line. 9. Create a new object of type TRAFFIC BUS that moves along the tourist bus line. To make the bus driving back and forth infinitely, call feature set reiterate (True) on the bus. To hand in Submit the class text of OBJECT CREATION to your assistant. 4
5 2 Temperature application In this task you will write an application which converts temperatures between Celsius, Fahrenheit, and Kelvin units. The application should consist of two classes: TEMPERATURE and TEMPERATURE APPLICATION. The latter is the root class. Things you need to know To print something in the console window, use io.put string, io.put integer, io.put boolean and so on, deping on the type of the argument. To read user input, use io.read... This places the read value in a buffer. Use io.last... to retrieve the value from the buffer. As an example, reading an INTEGER from the console and then displaying it on the screen, looks as follows: f is Read integer and display it. local i : INTEGER do io. read integer i := io. last integer io. put integer (i) The formulas for conversion: To do F ahrenheit = (9/5) Celsius + 32 Kelvin = Celsius Launch EiffelStudio. Create a new project of type Basic application (no graphics library included), using the settings shown in figure 1. Figure 1: New project 5
6 Download the skeleton class for TEMPERATURE from F/eprog-0001/exercises/ex4/temperature.e and put it into your project. Implement the class TEMPERATURE. Note that the conversion features are queries and thus should not change the existing object (no side effects), but create new objects. Do not forget to add contracts (temperature objects have obvious invariants and class TEMPERATURE should capture them). Feature make in class TEMPERATURE APPLICATION should use the TEMPERA- TURE class to do the following: 1. Ask the user to enter a temperature in Celsius. 2. Create a temperature object with the input value. 3. Convert the temperature to Fahrenheit and display it. 4. Convert the temperature to Kelvin and display it. 5. Repeat points 1 4 for temperatures in Kelvin and Fahrenheit. The execution of your application should yield the result shown in figure 2. Figure 2: Console To hand in Submit the class files for TEMPERATURE and TEMPERATURE APPLICATION. 3 It s Logic! To do 1. Describe the difference between non-strict and strict boolean operators. 2. Explain when you would prefer non-strict operators over strict operators and give an example for: and 6
7 and then or or else To hand in Hand in your solution to the two questions above. 7
Assignment 4: Object creation
Assignment 4: Object creation ETH Zurich Hand-out: 15 November 2005 Due: 22 November 2005 Copyright FarWorks, Inc. Gary Larson 1 Summary Today you are going to write your rst stand-alone program. Please
More informationAssignment 3: Of objects and features
Assignment 3: Of objects and features ETH Zurich handout: Monday, 29 September 2014 Due: Wednesday, 8 October 2014 Preferred Chat System c Randall Munroe (http://xkcd.com/1254) Goals Understand the difference
More informationSolution 3: Of objects and features
Solution 3: Of objects and features ETH Zurich 1 Classes vs. objects There is no unique solution. Sample answers: 1.1 A class can be viewed as a software module (a piece of source code that contains descriptions
More informationIntroduction to Eiffel
Introduction to Eiffel Martin Nordio, Christian Estler ETH Zurich Distributed Software Engineering Lab 1 Overview Part 1: Language Constructs Ø Basics: definition, if then else, expressions, loops and
More informationMock exam 1. ETH Zurich. Date: 9./10. November 2009
Mock exam 1 ETH Zurich Date: 9./10. November 2009 Name: Group: 1 Terminology (8 points) Put checkmarks in the checkboxes corresponding to the correct answers. Multiple correct answers are possible; there
More informationAssignment 7: Inheritance
Assignment 7: Inheritance ETH Zurich Hand-out: 11 December 2006 Due: 19 December 2006 Calvin and Hobbes c Bill Watterson 1 Dynamic exercise Goal Understand the effects of dynamic binding. Summary Have
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 3: Dealing with Objects II Programming languages The programming language is
More informationAssertions, pre/postconditions
Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What
More informationUC Santa Barbara. CS189A - Capstone. Christopher Kruegel Department of Computer Science UC Santa Barbara
CS189A - Capstone Christopher Kruegel Department of Computer Science http://www.cs.ucsb.edu/~chris/ Design by Contract Design by Contract and the language that implements the Design by Contract principles
More informationProject Report for Touch of class - Examples Chapter 7 to 9
for Touch of class - Examples Chapter 7 to 9 Damien Müllhaupt Corinne Müller ETH Zürich January 18, 2008 1 Contents 1 Overview 3 2 Scope of work 3 3 Touch of class Chapter 7 3 3.1 Touch Paris objects...........................
More informationFondamenti della Programmazione: Metodi Evoluti. Lezione 5: Invariants and Logic
Fondamenti della Programmazione: Metodi Evoluti Prof. Enrico Nardelli Lezione 5: Invariants and Logic versione originale: http://touch.ethz.ch Reminder: contracts Associated with an individual feature:
More informationACS-1805 Introduction to Programming (with App Inventor)
ACS-1805 Introduction to Programming (with App Inventor) Chapter 9 Paris Map Tour 11/1/2018 1 What We Will Learn In this chapter we ll build a tour guide app for a trip to Paris This chapter introduces
More informationLecture 13: Introduction to inheritance and genericity
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 13: Introduction to inheritance and genericity On the menu for today (& next
More informationEiffel: Analysis, Design and Programming. ETH Zurich, September-December Exception handling
Eiffel: Analysis, Design and Programming ETH Zurich, September-December 2008-6- Exception handling What is an exception? An abnormal event Not a very precise definition Informally: something that you don
More informationCS 150 Lab 3 Arithmetic and the Debugger. Lab 3.0 We are going to begin using the Visual Studio 2017 debugger to aid with debugging programs.
CS 150 Lab 3 Arithmetic and the Debugger The main objective of today s lab is to use some basic mathematics to solve a few real world problems. In doing so, you are to begin getting accustomed to using
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5 Today Attributes, formal arguments, and local variables Control structures
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2 Organizational Assignments Testat One assignment per week Will be
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class Client, supplier Definitions A client of a software
More informationEiffel Loops & Iteration
EIFFEL SOFTWARE Eiffel Loops & Iteration 16 MAY 2018 SUMMARY GENERALLY ITERABLE THINGS ACROSS LOOP - BASICS ACROSS LOOP - INDEXING ACROSS LOOP - REVERSING ACROSS LOOP - SKIPPING ACROSS LOOP - ARRAY ACROSS
More informationIn-Class Exercises. ETH Zurich. ETH students recently designed a special kind of oven for cooking potatoes. Here are some facts about such an oven:
In-Class Exercises ETH Zurich 1 Contracts ETH students recently designed a special kind of oven for cooking potatoes. Here are some facts about such an oven: each oven is equipped with a door which is
More informationUniverse Type System for Eiffel. Annetta Schaad
Universe Type System for Eiffel Annetta Schaad Semester Project Report Software Component Technology Group Department of Computer Science ETH Zurich http://sct.inf.ethz.ch/ SS 2006 Supervised by: Dipl.-Ing.
More informationScope of this lecture. Repetition For loops While loops
REPETITION CITS1001 2 Scope of this lecture Repetition For loops While loops Repetition Computers are good at repetition We have already seen the for each loop The for loop is a more general loop form
More informationSoftware Architecture 4. July 2005
Chair of Software Engineering Bertrand Meyer Software Architecture 4. July 2005 Name, First name:... I confirm with my signature, that I was able to take this exam under regular conditions and that I have
More informationCSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, October 13, 2015
QUEENS COLLEGE Department of Computer Science CSCI 111 Midterm 1, version A Exam Fall 2015 10.13.15 Solutions 09.00am 09.50am, Tuesday, October 13, 2015 Problem 1 Write a complete C++ program that does
More informationETHZ D-INFK Final Exam Booklet
ETHZ D-INFK Booklet Date: 15 December 2009 Surname, first name:... Student number:... I confirm with my signature, that I was able to take this exam under regular circumstances and that I have read and
More informationTDD + ESpec. Test-Driven Development. A test specifies a class interface. Test First Square Root of 10
Test-Driven Development TDD + ESpec TDD Test Driven Design» Change in software development paradigm» Write tests before code!!! > Step One: write a little test > Step Two: make it pass > Step Three: refactor»
More informationIn-Class Exercises. ETH Zurich. November
In-Class Exercises ETH Zurich November 28 2012 1 Contracts ETH students recently designed a special kind of oven for cooking potatoes. Here are some facts about such an oven: each oven is equipped with
More informationThe Eiffel language. Slides partly based on :
The Eiffel language Slides partly based on : http://se.inf.ethz.ch/courses/2015b_fall/eprog/english_index.html Eiffel, in brief Procedural, object-oriented programming language created by Bertrand Meyer
More informationIntroduction to C++ with content from
Introduction to C++ with content from www.cplusplus.com 2 Introduction C++ widely-used general-purpose programming language procedural and object-oriented support strong support created by Bjarne Stroustrup
More informationAutomated Fixing of Programs with Contracts
Automated Fixing of Programs with Contracts Yi Wei, Yu Pei, Carlo A. Furia, Lucas S. Silva, Stefan Buchholz, Bertrand Meyer and Andreas Zeller Chair of Software Engineering, ETH Zürich Software Engineering
More informationSingleton Pattern Creational. » Ensure a class has only one instance» Provide a global point of access
Singleton Pattern Creational Intent» Ensure a class has only one instance» Provide a global point of access Motivation Some classes must only have one instance file system, window manager Applicability»
More informationLab 7: OCaml 12:00 PM, Oct 22, 2017
CS17 Integrated Introduction to Computer Science Hughes Lab 7: OCaml 12:00 PM, Oct 22, 2017 Contents 1 Getting Started in OCaml 1 2 Pervasives Library 2 3 OCaml Basics 3 3.1 OCaml Types........................................
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5 Today Ø Attributes, formal arguments, and local variables Ø Control
More informationn Specifying what each method does q Specify it in a comment before method's header n Precondition q Caller obligation n Postcondition
Programming as a contract Assertions, pre/postconditions and invariants Assertions: Section 4.2 in Savitch (p. 239) Loop invariants: Section 4.5 in Rosen Specifying what each method does q Specify it in
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationSolution 6: Loopy games
Solution 6: Loopy games ETH Zurich 1 Loop painting Listing 1: Class LOOP PAINTING note description : Drawing figures with asterisks. LOOP PAINTING create make feature Initialization make Get size and paint.
More informationLecture 18 Tao Wang 1
Lecture 18 Tao Wang 1 Abstract Data Types in C++ (Classes) A procedural program consists of one or more algorithms that have been written in computerreadable language Input and display of program output
More informationProgramming Assignment IV Due Thursday, June 1, 2017 at 11:59pm
Programming Assignment IV Due Thursday, June 1, 2017 at 11:59pm 1 Introduction In this assignment, you will implement a code generator for Cool. When successfully completed, you will have a fully functional
More informationChapter 10 Introduction to Classes
C++ for Engineers and Scientists Third Edition Chapter 10 Introduction to Classes CSc 10200! Introduction to Computing Lecture 20-21 Edgardo Molina Fall 2013 City College of New York 2 Objectives In this
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 informationC# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh
C# Fundamentals Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC 2018/19
More informationCompilers Project 3: Semantic Analyzer
Compilers Project 3: Semantic Analyzer CSE 40243 Due April 11, 2006 Updated March 14, 2006 Overview Your compiler is halfway done. It now can both recognize individual elements of the language (scan) and
More informationCS 211 Programming Practicum Fall 2018
Due: Wednesday, 11/7/18 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a C++ program that will evaluate an infix expression. The algorithm REQUIRED for this program will
More informationExceptions and Design
Exceptions and Exceptions and Table of contents 1 Error Handling Overview Exceptions RuntimeExceptions 2 Exceptions and Overview Exceptions RuntimeExceptions Exceptions Exceptions and Overview Exceptions
More informationCS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,
More informationProgramming Assignment IV Due Thursday, November 18th, 2010 at 11:59 PM
Programming Assignment IV Due Thursday, November 18th, 2010 at 11:59 PM 1 Introduction In this assignment, you will implement a code generator for Cool. When successfully completed, you will have a fully
More informationReview Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous
Assignment 3 Methods Review CSC 123 Fall 2018 Notes: All homework must be submitted via e-mail. All parts of assignment must be submitted in a single e-mail with multiple attachments when required. Notes:
More informationFaculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2013 C++ Programming Language Lab # 6 Functions C++ Programming Language Lab # 6 Functions Objective: To be familiar with
More informationFunctions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.
Lab 4 Functions Introduction: A function : is a collection of statements that are grouped together to perform an operation. The following is its format: type name ( parameter1, parameter2,...) { statements
More informationCS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation
CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation Assigned: Sunday, November 14, 2004 Due: Thursday, Dec 9, 2004, at 11:59pm No solution will be accepted after Sunday, Dec 12,
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 25, 2017 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Function Details Assert Statements
More informationIndex. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309
A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48
More informationLecture 5. Defining Functions
Lecture 5 Defining Functions Announcements for this Lecture Last Call Quiz: About the Course Take it by tomorrow Also remember the survey Readings Sections 3.5 3.3 today Also 6.-6.4 See online readings
More informationCSCE 121 ENGR 112 List of Topics for Exam 1
List of Topics for Exam 1 If statements o How is an if statement constructed? o Does every if need an else? Looping o While loop! What does a while loop look like?! How do you ensure you will not have
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationTest-Driven Development (TDD)
Test-Driven Development (TDD) EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG DbC: Supplier DbC is supported natively in Eiffel for supplier: class ACCOUNT create make feature -- Attributes owner :
More informationIntroduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language
Introduction C++ widely-used general-purpose programming language procedural and object-oriented support strong support created by Bjarne Stroustrup starting in 1979 based on C Introduction to C++ also
More informationStarting to Program in C++ (Basics & I/O)
Copyright by Bruce A. Draper. 2017, All Rights Reserved. Starting to Program in C++ (Basics & I/O) On Tuesday of this week, we started learning C++ by example. We gave you both the Complex class code and
More informationChapter void Functions. Overview. Functions for All Subtasks. void-functions. Using a void-function. void-function Definition
Chapter 5 Functions for All Subtasks Overview 5.1 void Functions 5.2 Call-By-Reference Parameters 5.3 Using Procedural Abstraction 5.4 Testing and Debugging 5.5 General Debugging Techniques Copyright 2011
More informationObject Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 30, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
More informationCompiler Errors. Flash CS4 Professional ActionScript 3.0 Language Reference. 1 of 18 9/6/2010 9:40 PM
1 of 18 9/6/2010 9:40 PM Flash CS4 Professional ActionScript 3.0 Language Reference Language Reference only Compiler Errors Home All Packages All Classes Language Elements Index Appendixes Conventions
More informationJavaScript: More Syntax
JavaScript: More Syntax CISC 282 October 23, 2018 null and undefined What s the difference? null is synonymous with nothing i.e., no value, nothing there undefined is synonymous with the unknown i.e.,
More informationSoftware Development. Modular Design and Algorithm Analysis
Software Development Modular Design and Algorithm Analysis Precondition and Postcondition To create a good algorithm, a programmer must be able to analyse a precondition (starting state) and a postcondition
More informationWrapping a complex C++ library for Eiffel. FINAL REPORT July 1 st, 2005
Wrapping a complex C++ library for Eiffel FINAL REPORT July 1 st, 2005 Semester project Student: Supervising Assistant: Supervising Professor: Simon Reinhard simonrei@student.ethz.ch Bernd Schoeller Bertrand
More informationA web-based IDE for Java
A web-based IDE for Java Software Engineering Laboratory By: Supervised by: Marcel Bertsch Christian Estler Dr. Martin Nordio Prof. Dr. Bertrand Meyer Student Number: 09-928-896 Content 1 Introduction...3
More informationConception of a static oriented language : an overview of SCOOL
Conception of a static oriented language : an overview of SCOOL Thomas Moulard Technical Report n o 0610, June 2006 revision 963 SCOOL is a static oriented language designed to solve the problems encountered
More informationContract Programming For C++0x
Contract Programming For C++0x WG21/N1800 and J16/05-0060 Lawrence Crowl and Thorsten Ottosen lawrence.crowl@sun.com and nesotto@cs.aau.dk 2005-04-27 Overview This is an annotated version of the presentation
More informationForth Meets Smalltalk. A Presentation to SVFIG October 23, 2010 by Douglas B. Hoffman
Forth Meets Smalltalk A Presentation to SVFIG October 23, 2010 by Douglas B. Hoffman 1 CONTENTS WHY FMS? NEON HERITAGE SMALLTALK HERITAGE TERMINOLOGY EXAMPLE FMS SYNTAX ACCESSING OVERRIDDEN METHODS THE
More informationJOURNAL OF OBJECT TECHNOLOGY
JOURNAL OF OBJECT TECHNOLOGY Online at www.jot.fm. Published by ETH Zurich, Chair of Software Engineering JOT, 2002 Vol. 1, no. 4, September-October 2002 Eiffel Assertions and the External Structure of
More informationCSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige
CSC 308 2.0 System Development with Java Exception Handling Department of Statistics and Computer Science 1 2 Errors Errors can be categorized as several ways; Syntax Errors Logical Errors Runtime Errors
More informationFORTRAN Basis. PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name]
PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name] Content in [] is optional. Example:- PROGRAM FIRST_PROGRAM IMPLICIT NONE PRINT*,
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationSession 3: JavaScript - Structured Programming
INFM 603: Information Technology and Organizational Context Session 3: JavaScript - Structured Programming Jimmy Lin The ischool University of Maryland Thursday, September 25, 2014 Source: Wikipedia Types
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 8: Control Structures I In this (double) lecture The notion of algorithm Basic
More informationCOMP-202: Foundations of Programming
COMP-202: Foundations of Programming Lecture 3: Basic data types Jackie Cheung, Winter 2016 Review: Hello World public class HelloWorld { } public static void main(string[] args) { } System.out.println("Hello,
More informationType Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004
Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...
More informationHonors Computer Science C++ Mr. Clausen Program 6A, 6B, 6C, & 6G
Honors Computer Science C++ Mr. Clausen Program 6A, 6B, 6C, & 6G Special Note: Every program from Chapter 4 to the end of the year needs to have functions! Program 6A: Celsius To Fahrenheit Or Visa Versa
More informationAssignment 2: Temperature Class
Assigned: September 23, 2016 Due: October 03, 2016, 11:59:59pm Assignment 2: Temperature Class Purpose The purpose of this project is to provide you more practice with implementing classes. Here you will
More informationAnnouncements for the Class
Lecture 2 Classes Announcements for the Class Readings Section 1.4, 1.5 in text Section 3.1 in text Optional: PLive CD that comes with text References in text Assignment Assignment 1 due next week Due
More informationC# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals
C# Types Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:
More informationClasses The Static Structure
Classes The Static Structure Abstract data types equipped with a possibly partial implementation 04-1 Style Rules Read page 180 Pick a style and stick to it Recommend that you use Eiffel style or close
More informationC++ (Non for C Programmer) (BT307) 40 Hours
C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular
More informationEinführung in die Programmierung Introduction to Programming
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10 News Mock exam in 2 weeks (December 6 th, 7 th ) You have to be present
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationIndustrial Programming
Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 C# Types Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:
More informationSyntax of Eiffel: a Brief Overview
Syntax of Eiffel: a Brief Overview EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG Escape Sequences Escape sequences are special characters to be placed in your program text. In Java, an escape sequence
More informationGraphical User Interface for Roboscoop Applications
Graphical User Interface for Roboscoop Applications Bachelor Thesis Jonas Stulz Nobember 10, 2014 Advisors: Andrey Rusakov, Dr. Bertrand Meyer Department of Software Engeneering, ETH Zürich Abstract Software
More informationstep is to see how C++ implements type polymorphism, and this Exploration starts you on that journey.
EXPLORATION 36 Virtual Functions Deriving classes is fun, but there s not a lot you can do with them at least, not yet. The next step is to see how C++ implements type polymorphism, and this Exploration
More informationChapter 1. Section 1.4 Subprograms or functions. CS 50 - Hathairat Rattanasook
Chapter 1 Section 1.4 Subprograms or functions 0 Functions Functions are essential in writing structured and well-organized code. Functions help for code to be reused. Functions help to reduce errors and
More informationSingleton Pattern Creational
Singleton Pattern Creational Intent» Ensure a class has only one instance» Provide a global point of access Motivation Some classes must only have one instance file system, window manager Applicability»
More informationTraffic 3.1 Getting Started
Traffic 3.1 Getting Started Semester Thesis By: Supervised by: Matthias Loeu Michela Pedroni Prof. Bertrand Meyer Student Number: 03-928-207 Abstract Since 2003 the Chair of Software Engineering at the
More informationBON Business Object Notation Based on slides by Prof. Paige
BON Business Object Notation Based on slides by Prof. Paige 17-1 What is it? Notation for modeling object oriented software» Static: specifies classes, class relationships» Dynamic: behavioural properties
More informationCommands, and Queries, and Features. Syntax of Eiffel: a Brief Overview. Escape Sequences. Naming Conventions
Commands, and Queries, and Features Syntax of Eiffel: a Brief Overview EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG In a Java class: Attributes: Data Mutators: Methods that change attributes without
More informationVALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR
VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and
More informationa correct statement? You need to know what the statement is supposed to do.
Using assertions for correctness How can we know that software is correct? It is only correct if it does what it is supposed to do. But how do we know what it is supposed to do? We need a specification.
More informationObject-Oriented Software Construction
1 Object-Oriented Software Construction Bertrand Meyer 2 Lecture 2: EiffelStudio and project presentation Agenda for today 3 EiffelStudio: The ISE Eiffel environment Project presentation Agenda for today
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationCHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad
CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Program Components in C++ 3. Math Library Functions 4. Functions 5. Function Definitions 6. Function Prototypes 7. Header Files 8.
More informationIntroduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.
Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and
More informationCS193E: Temperature Converter Walkthrough
CS193E: Temperature Converter Walkthrough The goal of this walkthrough is to give you a fairly step by step path through building a simple Cocoa application. You are encouraged to follow the walkthrough,
More information