Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SOLUTION REQUIRED WITH THE CONCEPT OF OBJECT ORIENTED PROGRAMMING ( OOP ) IN C++ WITHOUT ERRORS. Conceptually, the stack class or abstract data type mimics

SOLUTION REQUIRED WITH THE CONCEPT OF OBJECT ORIENTED PROGRAMMING ( OOP ) IN C++ WITHOUT ERRORS.

Conceptually, the stack class or abstract data type mimics the information kept in a pile on a desk. Informally, we first consider a material on a desk, where we may keep separate piles for bills that need paying, magazines that we plan to read, and notes we have taken. These piles of materials have several properties. Each pile contains some papers (information). In addition, for each pile, we can do several tasks: Start a new pile, Place new information on the top of a pile, Take the top item off of the pile, Read the item on the top, and Determine whether a pile is empty. (There may be nothing at the spot where the pile should be.) These operations allow us to do all the normal processing of data at a desk. For example, when we receive bills in the mail, we add them to the pile of bills until payday comes. We then take the bills, one at a time, off the top of the pile and pay them until the money runs out. When discussing these operations it is customary to call the addition of an item to the top of the pile a Push operation and the deletion of an item from the top a Pop operation. More formally, a stack is defined as a class that can store data and that has the following operations: Make-Stack Create a new, empty stack object. Empty Empty returns true or false (1 or 0), depending upon whether the stack contains any items or not. Push Push adds the specified item to the top of the stack. Pop If the stack is not empty, Pop removes the top item from the stack, and this item is returned. If the stack is empty, nothing is returned, and an error is reported. Top If the stack is not empty, the top item is returned, but the contents of the stack are not changed. If the stack is empty, nothing is returned, and an error is reported. Write a program to create template-based stack. Store int and float in it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

denigration of emotional outbursts; being reserved;

Answered: 1 week ago