<< Chapter < Page | Chapter >> Page > |
b. Construct a derived class named CPoint_3D from the class CPoint, described as follows:
c. Include the class constructed in a) and b) in a working C++ program. Have your program call all of the member functions in the CPoint_3D class.
This project aims to review all the chapters from Chapter 1 (Introduction to Computers and Programming) to Chapter 6 (Functions and Pointers) which focus on structured programming.
An example of Project 1 can be described as follows:
The Colossus Airlines fleet consists of one plane with a seating capacity of 12. It makes one flight daily. Write a seating reservation program with the following features:
This project aims to review all the chapters from Chapter 7 (Introduction to Classes) to Chapter 8 (Object Manipulation - Inheritance) which focus on the basics of object-oriented programming.
An example of Project 2 can be described as follows:
A stack is an ordered collection of data items in which access is possible only at one end, called the top of the stack with the following basic operations:
It would be nice to have a stack class, because we could then use it to easily develop some applications which need stack data structure.
For the moment, assume that we need to define an integer stack class. Since a stack must stores a collection of integers, we can use an integer array to model the stack and a “pointer” named Top to indicate the location of the top of the stack. The array should have a fixed size. So we can begin the declaration of the class by selection two data members:
As for the member functions of the stack class, we have to define 5 member functions: the constructor which creates an empty stack and four other member functions (push, pop, check if the stack is empty, check if the stack is full).
After defining the stack class, write a main() function which does the following tasks:
Next, apply the stack data structure in solving the following problem: write a program that accepts a string from the user and prints the string backward. (Hint: Use a character stack)
Notification Switch
Would you like to follow the 'Programming fundamentals in c++' conversation and receive update notifications?