Ch 7-1. Object-Oriented Programming and Classes

Size: px
Start display at page:

Download "Ch 7-1. Object-Oriented Programming and Classes"

Transcription

1 Ch 7-1. Object-Oriented Programming and Classes May 10, 2014 Advanced Networking Technology Lab. (YU-ANTL) Dept. of Information & Comm. Eng, Graduate School, Yeungnam University, KOREA (Tel : ; Fax : ytkim@yu.ac.kr)

2 Outline Classes Object-Oriented Programming Concept Defining, member functions Public and private members Accessor and mutator functions Structures vs. classes ch

3 Major Considerations in Large-scale Software System Developments Procedure of Design, Development and Maintenance of Large-Scale Software Requirements analysis Software design Unit testing Component testing System testing Maintenance Major Considerations Clear unit/component/sub-system interface Stability of unit/component/sub-system Easy modification/update of unit/component/sub-system without great impact on other parts Easy employment of new technology for unit/component/sub-system ch

4 Object-Oriented Programming (OOP) Object-Oriented Programming Object-oriented programming (OOP) (객체 지향형 프로그래밍) an approach to designing modular, reusable software systems a programming paradigm that represents the concept of "objects" that have data fields (attributes that describe the object) and associated procedures known as methods Objects, which are usually instances of classes, are used to interact with one another to design applications and computer programs Goals of object-oriented programming : Increased understanding: rather than talking about database tables and programming subroutines, the developer talks about things the user is familiar with: objects from their application domain Ease of maintenance and adoption of new technologies by the use of encapsulation and information hiding Ease of evolution by the use of inheritance and polymorphism ch

5 Similar to structures Classes Not only, just member data But also, adds member functions Integral to object-oriented programming Focus on objects Object: Contains data and operations Class: mold (주형 형틀, 거푸집) to instantiate an object In C++, variables of class type are objects ch

6 Class Definitions Defined similar to structures Example: class DayOfYear // name of new class type { public: // access specifier void output(); // member function int month; // data member int day; // data member }; Notice only member function s prototype Function s implementation is elsewhere ch

7 Declaring Objects Declared same as all variables Predefined types, structure types Example: DayOfYear today, birthday; Declares two objects of class type DayOfYear Objects include: Data (attribute) Members: month, day Operations (member functions) output() ch

8 Class Member Access Members accessed same as structures Example: today.month today.day And to access member function: today.output(); Invokes member function ch

9 Class Member Functions Must define or "implement" class member functions Like other function definitions Can be after main() definition Must specify class: void DayOfYear::output() { } :: is scope resolution operator Instructs compiler "what class" member is from Item before :: called type qualifier ch

10 Class Member Functions Definition Notice output() member function s definition (in next example) Refers to member data of class No qualifiers Function used for all objects of the class Will refer to "that object s" data when invoked Example: today.output(); Displays "today" object s data ch

11 Complete Class Example: Display 6.3 Class With a Member Function (1 of 4) ch

12 Display 6.3 Class With a Member Function (2 of 4) ch

13 Display 6.3 Class With a Member Function (3 of 4) ch

14 Display 6.3 Class With a Member Function (4 of 4) ch

15 Dot (.) operator and Scope Resolution (::) Operator Used to specify "of what thing" they are members Dot operator (.) : Specifies member of particular object Scope resolution operator (::) Specifies what class the function definition comes from class DayOfYear { public: // access specifier void output(); // member function int month; // data member int day; // data member }; DayOfYear today; today.year = 2014; today.month = 5; DayOfYear::output() { } ch

16 A Class s Place Class is full-fledged type! Just like data types int, double, etc. Can have variables of a class type We simply call them "objects" Can have parameters of a class type Pass-by-value Pass-by-reference Can use class type like any other type! ch

17 Encapsulation Any data type includes Data (range of data) Operations (that can be performed on data) Example: int data type has: Data: +-32,767 Operations: +,-,*,/,%, logical, etc. Same with classes But WE specify data, and the operations to be allowed on our data! ch

18 Abstract Data Type (ADT) "Abstract" Programmers don t know details Abbreviated "ADT" Collection of data values together with set of basic operations defined for the values ADT s often "language-independent" We implement ADT s in C++ with classes C++ class "defines" the ADT Other languages implement ADT s as well ch

19 Encapsulation More on Encapsulation Means "bringing together as one" Declare a class get an object Object is "encapsulation" of Data values (attributes) Operations on the data (member functions) ch

20 Encapsulation Principles of OOP Bring together data and operations, but keep "details" hidden Information Hiding Details of its implementations and its operations work not known to "user" of class Data Abstraction Details of how data is manipulated within ADT/class not known to user ch

21 Encapsulation in Object Encapsulation and protection of private data Object outside program interface to outside Friend Functions - cin >> // standard input - cout << // standard output Public Member Functions - get() // read with validity check - set() // write with validity check Private Member Functions - house keeping Private Data Members ch

22 Public and Private Members Data in class almost always designated private in definition! Upholds principles of OOP Hide data from user Allow manipulation only via operations Which are member functions Public items (usually member functions) are "user-accessible" ch

23 Public and Private Example Modify previous example: class DayOfYear { public: void input(); void output(); private: int month; int day; }; Data now private Objects have no direct access ch

24 Public and Private Example 2 Given previous example Declare object: DayOfYear today; Object today can ONLY access public members cin >> today.month; // NOT ALLOWED! cout << today.day; // NOT ALLOWED! Must instead call public operations: today.input(); today.output(); ch

25 Public and Private Style Typically place public first Allows easy viewing of portions that can be USED by programmers using the class Private data is "hidden", so irrelevant to users Can mix and match public and private Outside of class definition, cannot change (or even access) private data ch

26 Accessor and Mutator Functions Object needs to "do something" with its data Accessor member functions Allow object to read data Also called "get member functions" Simple retrieval of member data Mutator member functions Allow object to change data Manipulated based on application Set member functions ch

27 // Display 6.4 Class with Private Members #include <iostream> #include <cstdlib> using namespace std; class DayOfYear { public: void input( ); void output( ); void set(int newmonth, int newday); //Precondition: newmonth and newday form a possible date. void set(int newmonth); //Precondition: 1 <= newmonth <= 12 //Postcondition: The date is set to the first day of the given month. int getmonthnumber( ); //Returns 1 for January, 2 for February, etc. int getday( ); private: int month; int day; }; ch

28 int main( ) { DayOfYear today, bachbirthday; cout << "Enter today's date: n"; today.input( ); cout << "Today's date is "; today.output( ); cout << endl; bachbirthday.set(3, 21); cout << "J. S. Bach's birthday is "; bachbirthday.output( ); cout << endl; if ( today.getmonthnumber( ) == bachbirthday.getmonthnumber( ) && today.getday( ) == bachbirthday.getday( ) ) cout << "Happy Birthday Johann Sebastian! n"; else cout << "Happy Unbirthday Johann Sebastian! n"; } return 0; ch

29 //Uses iostream and cstdlib: void DayOfYear::set(int newmonth, int newday) { if ((newmonth >= 1) && (newmonth <= 12)) month = newmonth; else { cout << "Illegal month value! Program aborted. n"; exit(1); } if ((newday >= 1) && (newday <= 31)) day = newday; else { cout << "Illegal day value! Program aborted. n"; } } exit(1); //Uses iostream and cstdlib: void DayOfYear::set(int newmonth) { if ((newmonth >= 1) && (newmonth <= 12)) month = newmonth; else { cout << "Illegal month value! Program aborted. n"; } exit(1); } day = 1; ch

30 int DayOfYear::getMonthNumber( ) { return month; } int DayOfYear::getDay( ) { return day; } //Uses iostream and cstdlib: void DayOfYear::input( ) { cout << "Enter the month as a number: "; cin >> month; cout << "Enter the day of the month: "; cin >> day; if ((month < 1) (month > 12) (day < 1) (day > 31)) { cout << "Illegal date! Program aborted. n"; exit(1); } } ch

31 void DayOfYear::output( ) { switch (month) { case 1: cout << "January "; break; case 2: cout << "February "; break; case 3: cout << "March "; break; case 4: cout << "April "; break; case 5: cout << "May "; break; case 6: cout << "June "; break; case 7: cout << "July "; break; case 8: cout << "August "; break; case 9: cout << "September "; break; case 10: cout << "October "; break; case 11: cout << "November "; break; case 12: cout << "December "; break; default: cout << "Error in DayOfYear::output. Contact software vendor."; } // end switch } cout << day; ch

32 Separation of Interface and Implementation User of class need not see details of how class is implemented Principle of OOP encapsulation User only needs "rules" Called "interface" for the class In C++ public member functions and associated comments Implementation of class is hidden Member function definitions elsewhere User need not see them ch

33 Structures Typically all members public No member functions Structures vs. Classes Classes Typically all data members private Interface member functions public Technically, same Perceptionally, very different mechanisms ch

34 Thinking Objects Focus for programming changes Before algorithms center stage Object-Oriented Programming (OOP) data is focus Algorithms still exist They simply focus on their data Are "made" to "fit" the data Designing software solution Define variety of objects and how they interact ch

35 Summary Structure is collection of different types Class used to combine data and functions into single unit -> object Member variables and member functions Can be public accessed outside class Can be private accessed only in a member function s definition Class and structure types can be formal parameters to functions ch

36 C++ class definition Summary Should separate two key parts Interface: what user needs Implementation: details of how class works ch

37 Homework Structure of planets in the solar system. Each planet has following information: Name : a character string of less than 10 characters Relative-Mass : double type value of mass relative to Earth Distance from sun : double type value of mean distance from sun in [10 6 Km] 1) Design a structure for a planet with the information of planets. struct Planet { char name[10]; double relativemass; double distance; }; ch

38 2) Using the structure designed above, make an array Planet solar_planet[9], and initialize the array from an input file solar_planet.dat which contains following data : Name of Planet Relative Mass Distance from Sun Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto ) Using the solar_planet[ ] array, make a sorted list of solar planets in non-decreasing order of relative mass. Output the result to sortedsolarplanet.dat in the same format of input file. 4) Using the solar_planet[ ] array, make a sorted list of solar planets in non-decreasing order of distance from Sun. Output the result to sortedsolarplanet.dat in the same format of input file. 5) Using the solar_planet[ ] array, make a sorted list of solar planets in non-decreasing order of name of planet. Output the result to sortedsolarplanet.dat in the same format of input file. ch

39 7-1.2 Write a header file Class_Planet.h with a class Planet with following members: (1) Private Data members:. name: a character string of less than 10 characters. relativemass: double type value of mass relative to Earth. distance: double type value of mean distance from sun in [10 6 Km] (2) Public methods:. constructor: constructs the object instance of Planet with given arguments. destructor: destructs the object instance of Planet. print(): printout the name, relative mass and distance of the planet object. setname(): set name that truncate the name if the length is longer than 10 characters. setrelmass(): set relative mass when the passed value is greater than 0 and less than 100; otherwise the value is set to 0. setdist(): set distance when the passed value is greater than 0 and less than 10,000.. getname(): returns the name of the planet. getrelmass(): returns the relative distance. getdistance(): returns the distance ch

40 7-1.3 Write a header file SolarSystem.h that includes Class_Planet.h and contains a class SolarSystem with following members: (1) Private Data members:. planets: array of planet object instances (2) Public methods:. constructor: constructs the object instance of SolarSystem. destructor: destructs the object instance of SolarSystem. addplanet: create a new planet with given parameters for the planet. deleteplanet: delete a planet with the given planet name. sortplanetsbyname(): sort the planets in the solar system in the nondecreasing order of name. sortbyrelmass(): sort the planets in the solar system in the nondecreasing order of relative mass. sortbydistance():sort the planets in the solar system in the nondecreasing order of distance. print(): print outs the ordered list of planets in the solar system ch

41 7-1.4 Write a solarsystem.cpp that includes the header file Class_Planet.h and solarsystem.h. (1) This program reads in solarsystem.dat file to create & initialize the solar system. (2) It prints out the sorted list of planets in the solar system: i) in non-decreasing order of name, ii) in non-decreasing order of relative mass, iii) in non-decreasing order of distance. (3) Contents of solarsystem.dat file Name of Planet Relative Mass Distance from Sun Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto ch

EP241 Computer Programming

EP241 Computer Programming EP241 Computer Programming Topic 10 Basic Classes Department of Engineering Physics University of Gaziantep Course web page www.gantep.edu.tr/~bingul/ep241 Sep 2013 Sayfa 1 Introduction In this lecture

More information

Computer Programming C++ Classes and Objects 15 th Lecture

Computer Programming C++ Classes and Objects 15 th Lecture Computer Programming C++ Classes and Objects 15 th Lecture 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University Copyrights 2013 Eom, Hyeonsang All Rights Reserved Outline

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

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

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

More information

Note: Syntactically, a ; is needed at the end of a struct definition.

Note: Syntactically, a ; is needed at the end of a struct definition. Structs, Classes, and Arrays Structs A type representation containing a set of heterogeneous members with possibly varying types. struct Student { string name; int id; double tuition; ; Note: Syntactically,

More information

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

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

CpSc212 Goddard Notes Chapter 6. Yet More on Classes. We discuss the problems of comparing, copying, passing, outputting, and destructing

CpSc212 Goddard Notes Chapter 6. Yet More on Classes. We discuss the problems of comparing, copying, passing, outputting, and destructing CpSc212 Goddard Notes Chapter 6 Yet More on Classes We discuss the problems of comparing, copying, passing, outputting, and destructing objects. 6.1 Object Storage, Allocation and Destructors Some objects

More information

Course notes Standard C++ programming

Course notes Standard C++ programming Department of Cybernetics The University of Reading SE2B2 Further Computer Systems Course notes Standard C++ programming by Dr Virginie F. Ruiz November, 03 CREATING AND USING A COPY CONSTRUCTOR... 27

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

CISC 181 Project 3 Designing Classes for Bank Accounts

CISC 181 Project 3 Designing Classes for Bank Accounts CISC 181 Project 3 Designing Classes for Bank Accounts Code Due: On or before 12 Midnight, Monday, Dec 8; hardcopy due at beginning of lecture, Tues, Dec 9 What You Need to Know This project is based on

More information

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is preceded by an equal sign d. its name has undereline 2. Associations

More information

MS Visual C++ Introduction. Quick Introduction. A1 Visual C++

MS Visual C++ Introduction. Quick Introduction. A1 Visual C++ MS Visual C++ Introduction 1 Quick Introduction The following pages provide a quick tutorial on using Microsoft Visual C++ 6.0 to produce a small project. There should be no major differences if you are

More information

7.7 Case Study: Calculating Depreciation

7.7 Case Study: Calculating Depreciation 7.7 Case Study: Calculating Depreciation 1 7.7 Case Study: Calculating Depreciation PROBLEM Depreciation is a decrease in the value over time of some asset due to wear and tear, decay, declining price,

More information

5 CLASSES CHAPTER. 5.1 Object-Oriented and Procedural Programming. 5.2 Classes and Objects 5.3 Sample Application: A Clock Class

5 CLASSES CHAPTER. 5.1 Object-Oriented and Procedural Programming. 5.2 Classes and Objects 5.3 Sample Application: A Clock Class CHAPTER 5 CLASSES class head class struct identifier base spec union class name 5.1 Object-Oriented and Procedural Programming 5.2 Classes and Objects 5.3 Sample Application: A Clock Class 5.4 Sample Application:

More information

Basics of I/O Streams and File I/O

Basics of I/O Streams and File I/O Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

Member Functions of the istream Class

Member Functions of the istream Class Member Functions of the istream Class The extraction operator is of limited use because it always uses whitespace to delimit its reads of the input stream. It cannot be used to read those whitespace characters,

More information

Friends and Overloaded Operators

Friends and Overloaded Operators 8 Friends and Overloaded Operators 8.1 Friend Functions 460 Programming Example:An Equality Function 460 Friend Functions 461 Programming Tip:Define Both Accessor Functions and Friend Functions 465 Programming

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

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Goals for This Lecture:

Goals for This Lecture: Goals for This Lecture: Understand the pass-by-value and passby-reference argument passing mechanisms of C++ Understand the use of C++ arrays Understand how arrays are passed to C++ functions Call-by-value

More information

The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 01 Test #4 November 20, 2002. True or False (2 points each)

The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 01 Test #4 November 20, 2002. True or False (2 points each) True or False (2 points each) The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 01 Test #4 November 20, 2002 1. Using global variables is better style than using local

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

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 3: Input/Output Objectives In this chapter, you will: Learn what a stream is and examine input and output streams Explore

More information

Appendix K Introduction to Microsoft Visual C++ 6.0

Appendix K Introduction to Microsoft Visual C++ 6.0 Appendix K Introduction to Microsoft Visual C++ 6.0 This appendix serves as a quick reference for performing the following operations using the Microsoft Visual C++ integrated development environment (IDE):

More information

Advanced Data Structures

Advanced Data Structures C++ Advanced Data Structures Chapter 8: Advanced C++ Topics Zhijiang Dong Dept. of Computer Science Middle Tennessee State University Chapter 8: Advanced C++ Topics C++ 1 C++ Syntax of 2 Chapter 8: Advanced

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Comp151. Definitions & Declarations

Comp151. Definitions & Declarations Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions. Introducing Functions Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

More information

CS 101 Computer Programming and Utilization

CS 101 Computer Programming and Utilization CS 101 Computer Programming and Utilization Lecture 14 Functions, Procedures and Classes. primitive and objects. Files. Mar 4, 2011 Prof. R K Joshi Computer Science and Engineering IIT Bombay Email: rkj@cse.iitb.ac.in

More information

Sequential Program Execution

Sequential Program Execution Sequential Program Execution Quick Start Compile step once always g++ -o Realtor1 Realtor1.cpp mkdir labs cd labs Execute step mkdir 1 Realtor1 cd 1 cp../0/realtor.cpp Realtor1.cpp Submit step cp /samples/csc/155/labs/1/*.

More information

Course Title: Software Development

Course Title: Software Development Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.

More information

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction IS0020 Program Design and Software Tools Midterm, Feb 24, 2004 Name: Instruction There are two parts in this test. The first part contains 50 questions worth 80 points. The second part constitutes 20 points

More information

COSC 181 Foundations of Computer Programming. Class 6

COSC 181 Foundations of Computer Programming. Class 6 COSC 181 Foundations of Computer Programming Class 6 Defining the GradeBook Class Line 9 17 //GradeBook class definition class GradeBook { public: //function that displays a message void displaymessage()

More information

WORKSPACE WEB DEVELOPMENT & OUTSOURCING TRAINING CENTER

WORKSPACE WEB DEVELOPMENT & OUTSOURCING TRAINING CENTER WORKSPACE WEB DEVELOPMENT & OUTSOURCING TRAINING CENTER Course Outline (2015) Basic Programming With Procedural & Object Oriented Concepts (C, C++) Training Office# Road: 11, House: 1 A, Nikunja 2, Khilkhet,

More information

It has a parameter list Account(String n, double b) in the creation of an instance of this class.

It has a parameter list Account(String n, double b) in the creation of an instance of this class. Lecture 10 Private Variables Let us start with some code for a class: String name; double balance; // end Account // end class Account The class we are building here will be a template for an account at

More information

Moving from C++ to VBA

Moving from C++ to VBA Introduction College of Engineering and Computer Science Mechanical Engineering Department Mechanical Engineering 309 Numerical Analysis of Engineering Systems Fall 2014 Number: 15237 Instructor: Larry

More information

Java Application Developer Certificate Program Competencies

Java Application Developer Certificate Program Competencies Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle

More information

Polymorphism. Problems with switch statement. Solution - use virtual functions (polymorphism) Polymorphism

Polymorphism. Problems with switch statement. Solution - use virtual functions (polymorphism) Polymorphism Polymorphism Problems with switch statement Programmer may forget to test all possible cases in a switch. Tracking this down can be time consuming and error prone Solution - use virtual functions (polymorphism)

More information

Basics of C++ and object orientation in OpenFOAM

Basics of C++ and object orientation in OpenFOAM Basics of C++ and object orientation in OpenFOAM To begin with: The aim of this part of the course is not to teach all of C++, but to give a short introduction that is useful when trying to understand

More information

OKLAHOMA SUBJECT AREA TESTS (OSAT )

OKLAHOMA SUBJECT AREA TESTS (OSAT ) CERTIFICATION EXAMINATIONS FOR OKLAHOMA EDUCATORS (CEOE ) OKLAHOMA SUBJECT AREA TESTS (OSAT ) FIELD 081: COMPUTER SCIENCE September 2008 Subarea Range of Competencies I. Computer Use in Educational Environments

More information

Angular Velocity vs. Linear Velocity

Angular Velocity vs. Linear Velocity MATH 7 Angular Velocity vs. Linear Velocity Dr. Neal, WKU Given an object with a fixed speed that is moving in a circle with a fixed ius, we can define the angular velocity of the object. That is, we can

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

A.4 The Solar System Scale Model

A.4 The Solar System Scale Model CHAPTER A. LABORATORY EXPERIMENTS 25 Name: Section: Date: A.4 The Solar System Scale Model I. Introduction Our solar system is inhabited by a variety of objects, ranging from a small rocky asteroid only

More information

Conditions & Boolean Expressions

Conditions & Boolean Expressions Conditions & Boolean Expressions 1 In C++, in order to ask a question, a program makes an assertion which is evaluated to either true (nonzero) or false (zero) by the computer at run time. Example: In

More information

While Loop. 6. Iteration

While Loop. 6. Iteration While Loop 1 Loop - a control structure that causes a set of statements to be executed repeatedly, (reiterated). While statement - most versatile type of loop in C++ false while boolean expression true

More information

Introduction to C++ Introduction to C++ Week 7 Dr Alex Martin 2013 Slide 1

Introduction to C++ Introduction to C++ Week 7 Dr Alex Martin 2013 Slide 1 Introduction to C++ Introduction to C++ Week 7 Dr Alex Martin 2013 Slide 1 Introduction to Classes Classes as user-defined types We have seen that C++ provides a fairly large set of built-in types. e.g

More information

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer

More information

Chapter 1: Key Concepts of Programming and Software Engineering

Chapter 1: Key Concepts of Programming and Software Engineering Chapter 1: Key Concepts of Programming and Software Engineering Software Engineering Coding without a solution design increases debugging time - known fact! A team of programmers for a large software development

More information

Basic Programming and PC Skills: Basic Programming and PC Skills:

Basic Programming and PC Skills: Basic Programming and PC Skills: Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of

More information

For the next three questions, consider the class declaration: Member function implementations put inline to save space.

For the next three questions, consider the class declaration: Member function implementations put inline to save space. Instructions: This homework assignment focuses on basic facts regarding classes in C++. Submit your answers via the Curator System as OQ4. For the next three questions, consider the class declaration:

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

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

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

More information

Computer Programming I

Computer Programming I Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,

More information

6. Control Structures

6. Control Structures - 35 - Control Structures: 6. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose,

More information

x Distance of the Sun to planet --------------------------------------------------------------------

x Distance of the Sun to planet -------------------------------------------------------------------- Solar System Investigation 26C 26C Solar System How big is the solar system? It is difficult to comprehend great distances. For example, how great a distance is 140,000 kilometers (the diameter of Jupiter)

More information

J a v a Quiz (Unit 3, Test 0 Practice)

J a v a Quiz (Unit 3, Test 0 Practice) Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

Copyright 2001, Bill Trudell. Permission is granted to copy for the PLoP 2001 conference. All other rights reserved.

Copyright 2001, Bill Trudell. Permission is granted to copy for the PLoP 2001 conference. All other rights reserved. The Secret Partner Pattern Revision 3a by Bill Trudell, July 23, 2001 Submitted to the Pattern Languages of Programs Shepherd: Neil Harrison PC Member: Kyle Brown Thumbnail This paper describes the Secret

More information

CS 241 Data Organization Coding Standards

CS 241 Data Organization Coding Standards CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.

More information

C++ Crash Kurs. C++ Object-Oriented Programming

C++ Crash Kurs. C++ Object-Oriented Programming C++ Crash Kurs C++ Object-Oriented Programming Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck http://www.itm.uni-luebeck.de/people/pfisterer C++ classes A class is user-defined type

More information

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection

More information

Brent A. Perdue. July 15, 2009

Brent A. Perdue. July 15, 2009 Title Page Object-Oriented Programming, Writing Classes, and Creating Libraries and Applications Brent A. Perdue ROOT @ TUNL July 15, 2009 B. A. Perdue (TUNL) OOP, Classes, Libraries, Applications July

More information

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities The classroom is set up like a traditional classroom on the left side of the room. This is where I will conduct my

More information

! " # $ %& %' ( ) ) *%%+, -..*/ *%%+ - 0 ) 1 2 1

!  # $ %& %' ( ) ) *%%+, -..*/ *%%+ - 0 ) 1 2 1 !" #$%&%'())*%%+,-..*/*%%+- 0 )12 1 *!" 34 5 6 * #& ) 7 8 5)# 97&)8 5)# 9 : & ; < 5 11 8 1 5)=19 7 19 : 0 5)=1 ) & & >) ) >) 1? 5)= 19 7 19 : # )! #"&@)1 # )? 1 1#& 5)=19719:# 1 5)=9 7 9 : 11 0 #) 5 A

More information

Data Structures using OOP C++ Lecture 1

Data Structures using OOP C++ Lecture 1 References: 1. E Balagurusamy, Object Oriented Programming with C++, 4 th edition, McGraw-Hill 2008. 2. Robert Lafore, Object-Oriented Programming in C++, 4 th edition, 2002, SAMS publishing. 3. Robert

More information

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language Simple C++ Programs Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input and Output Basic Functions from

More information

Automation of Library (Codes) Development for Content Management System (CMS)

Automation of Library (Codes) Development for Content Management System (CMS) Automation of Library (Codes) Development for Content Management System (CMS) Mustapha Mutairu Omotosho Department of Computer Science, University Of Ilorin, Ilorin Nigeria Balogun Abdullateef Oluwagbemiga

More information

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be...

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be... What is a Loop? CSC Intermediate Programming Looping A loop is a repetition control structure It causes a single statement or a group of statements to be executed repeatedly It uses a condition to control

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

Toilet Paper Solar System

Toilet Paper Solar System LEADER INSTRUCTIONS Toilet Paper Solar System Adapted by Suzanne Chippindale Based on an idea by the late Gerald Mallon, a planetarium educator who spent his life helping students understand the Universe.

More information

Chapter 25.1: Models of our Solar System

Chapter 25.1: Models of our Solar System Chapter 25.1: Models of our Solar System Objectives: Compare & Contrast geocentric and heliocentric models of the solar sytem. Describe the orbits of planets explain how gravity and inertia keep the planets

More information

Passing 1D arrays to functions.

Passing 1D arrays to functions. Passing 1D arrays to functions. In C++ arrays can only be reference parameters. It is not possible to pass an array by value. Therefore, the ampersand (&) is omitted. What is actually passed to the function,

More information

Facebook Twitter YouTube Google Plus Website Email

Facebook Twitter YouTube Google Plus Website Email PHP MySQL COURSE WITH OOP COURSE COVERS: PHP MySQL OBJECT ORIENTED PROGRAMMING WITH PHP SYLLABUS PHP 1. Writing PHP scripts- Writing PHP scripts, learn about PHP code structure, how to write and execute

More information

Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition

Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition This book may be ordered from Addison-Wesley in a value pack that includes Microsoft Visual C++ 2010 Express Edition. Visual C++ 2010

More information

Syllabus OBJECT ORIENTED PROGRAMMING C++

Syllabus OBJECT ORIENTED PROGRAMMING C++ 1 Syllabus OBJECT ORIENTED PROGRAMMING C++ 1. Introduction : What is object oriented programming? Why do we need objectoriented. Programming characteristics of object-oriented languages. C and C++. 2.

More information

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and

More information

Background Information Students will learn about the Solar System while practicing communication skills.

Background Information Students will learn about the Solar System while practicing communication skills. Teacher Information Background Information Students will learn about the Solar System while practicing communication skills. Materials clipboard for each student pencils copies of map and Available Destinations

More information

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements 9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

More information

CEC225 COURSE COMPACT

CEC225 COURSE COMPACT CEC225 COURSE COMPACT Course GEC 225 Applied Computer Programming II(2 Units) Compulsory Course Duration Two hours per week for 15 weeks (30 hours) Lecturer Data Name of the lecturer: Dr. Oyelami Olufemi

More information

The separation principle : a principle for programming language design

The separation principle : a principle for programming language design The University of Toledo The University of Toledo Digital Repository Theses and Dissertations 2013 The separation principle : a principle for programming language design Kris A. Armstrong The University

More information

Compiler Construction

Compiler Construction Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from

More information

CS193D Handout 06 Winter 2004 January 26, 2004 Copy Constructor and operator=

CS193D Handout 06 Winter 2004 January 26, 2004 Copy Constructor and operator= CS193D Handout 06 Winter 2004 January 26, 2004 Copy Constructor and operator= We already know that the compiler will supply a default (zero-argument) constructor if the programmer does not specify one.

More information

Lesson Name: Introduction of OOP

Lesson Name: Introduction of OOP Paper Code: Lesson no: 1 Author: Pooja Chawla Paper Name: OOP with C++ Lesson Name: Introduction of OOP Vetter: Prof. Dharminder Kumar Unit Structure: 1.1 Software crisis 1.2 Software Evaluation 1.3 POP

More information

TECHNICAL UNIVERSITY OF CRETE DATA STRUCTURES FILE STRUCTURES

TECHNICAL UNIVERSITY OF CRETE DATA STRUCTURES FILE STRUCTURES TECHNICAL UNIVERSITY OF CRETE DEPT OF ELECTRONIC AND COMPUTER ENGINEERING DATA STRUCTURES AND FILE STRUCTURES Euripides G.M. Petrakis http://www.intelligence.tuc.gr/~petrakis Chania, 2007 E.G.M. Petrakis

More information

C++ Outline. cout << "Enter two integers: "; int x, y; cin >> x >> y; cout << "The sum is: " << x + y << \n ;

C++ Outline. cout << Enter two integers: ; int x, y; cin >> x >> y; cout << The sum is:  << x + y << \n ; C++ Outline Notes taken from: - Drake, Caleb. EECS 370 Course Notes, University of Illinois Chicago, Spring 97. Chapters 9, 10, 11, 13.1 & 13.2 - Horstman, Cay S. Mastering Object-Oriented Design in C++.

More information

Computer Programming I

Computer Programming I Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement (e.g. Exploring

More information

How Big is our Solar System?

How Big is our Solar System? Name: School: Grade or Level: Lesson Plan #: Date: Abstract How Big is our Solar System? How big is the Earth? When it comes to the solar system, the earth is just a small part of a much larger system

More information