CSC241: Object Oriented Programming

Slides:



Advertisements
Similar presentations
Loops –Do while Do While Reading for this Lecture, L&L, 5.7.
Advertisements

1 CSC241: Object Oriented Programming Lecture No 21.
Introduction to Programming Lecture 39. Copy Constructor.
1 CSC241: Object Oriented Programming Lecture No 28.
1 CSC241: Object Oriented Programming Lecture No 07.
Computer Science and Software Engineering University of Wisconsin - Platteville 7. Inheritance and Polymorphism Yan Shi CS/SE 2630 Lecture Notes.
It holds the book together. It also tells you the book’s title, author, publisher and call number.
1 CSC241: Object Oriented Programming Lecture No 13.
1 CSC241: Object Oriented Programming Lecture No 12.
1 CSC241: Object Oriented Programming Lecture No 22.
1 CSC241: Object Oriented Programming Lecture No 16.
1 CSC241: Object Oriented Programming Lecture No 25.
EXERCISE Arrays, structs and file processing. Question You own a pet store. You want to keep an inventory of all the pets that you have. Pets available.
1 CSC103: Introduction to Computer and Programming Lecture No 24.
1 CSC241: Object Oriented Programming Lecture No 05.
Programming with LabVIEW Intro to programming and.
1 Class Chapter Objectives Use a while loop to repeat a series of statements Get data from user through an input dialog box Add error checking.
Title Page The title page is the first page in the book. It tells you the title of the book, the author and the illustrator. It also tells you who published.
1 CSC241: Object Oriented Programming Lecture No 08.
1 CSC103: Introduction to Computer and Programming Lecture No 9.
Infinite for Loop If you omit the test condition, the value is assumed to be TRUE so the loop will continue indefinitely unless you provide some other.
Lecture Five The Project 1. Wen Yu BNUZ LIMS Description Design a simple Library Information Management System (LIMS) for an university The system includes.
Introduction Every program takes some data as input and generate processed data as out put . It is important to know how to provide the input data and.
Book Recommendation Display
CSC 427: Data Structures and Algorithm Analysis
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CSC241: Object Oriented Programming
Tutorial 04 (cont’) Using XPath Patterns in an XSLT Style Sheet.
Data types Data types Basic types
CSC241: Object Oriented Programming
Week of 12/12/16 Test Review.
7. Inheritance and Polymorphism
Midterm Review.
CSC241: Object Oriented Programming
CSC241: Object Oriented Programming
Java's for Statement.
Psuedo Code.
Incrementing ITP © Ron Poet Lecture 8.
Presentation Title Your company information.
Presentation Title Your company information.
LINKED LISTS.
Array of objects.
More Loops.
More Loops.
Chapter 8 The Loops By: Mr. Baha Hanene.
Video list editor BIS1523 – Lecture 24.
Time to test your knowledge!
Array of objects.
Exercise 1 Modify some parameters in the histogram.js and see what would happen (one by one) 20 in Line 2  in Line 3  in Line 15  .9.
Looping III (do … while statement)
Review for Final Exam.
Lecture 3: Arrays & Pointers
Introduction to Programming
Linked Lists.
Data Structures & Algorithms
Basic Lessons 5 & 6 Mr. Kalmes.
Today’s Objectives 28-Jun-2006 Announcements
Lists CMSC 202, Version 4/02.
int [] scores = new int [10];
Chapter 4: Loops and Files
Learning Intention I will learn about the standard algorithm for input validation.
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
Book Recommendation Display
Array Fundamentals A simple example program will serve to introduce arrays. This program, REPLAY, creates an array of four integers representing the ages.
Intro to Programming (in JavaScript)
Why We Need Car Parking Systems - Wohr Parking Systems
Types of Stack Parking Systems Offered by Wohr Parking Systems
Add Title.
Presentation transcript:

CSC241: Object Oriented Programming Lecture No 24

Previous Lecture Efficient string class Dynamic Type Information Resolve problem while deleting String objects Dynamic Type Information dynamic_cast operator Checking class type pDerv1 = dynamic_cast<Derv1*>(pUnknown) Changing Pointer Types typeid operator Class name of object

Today’s Lecture Example programs Intro to Generic Programming Publication company Distance class Intro to Generic Programming template

Example program 1 Imagine the publishing company that markets both book and audiocassette versions of its works create a class publication (private data: title, price) derive two classes: book, which adds a page count (type int) tape, which adds a playing time in minutes (type float) Each of the three classes should have a getdata() function to get its data from the user at the keyboard, and a putdata() function to display the data Write a main() program that creates an array of pointers to publication

Cont. In a loop, ask the user for data about a book or tape, and use new to create an object of type book or tape When the user has finished entering the data display the resulting data using a for loop and a single statement such as pubarr[j]->putdata(); Write a program

Example program 2 In the Distance class, create an overloaded * operator so that two distances can be multiplied together. Make it a friend function so that you can use such expressions as dist1 = 7.5 * dist2; Write a main() program to test this operator. Write a program