Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume there is a Stock class which has symbol (string), cost (int) and shares (int) as private members. There is also a StockNode class which

Assume there is a Stock class which has symbol (string), cost (int) and shares (int) as private members. There is also a StockNode class which inherits Stock class. Further assume there are classes for storing collection of Stock as follows:

DBfwd.. stores stocks in a forward linked list

DBdlink.. stores stocks in a doubly-linked list

DBstack .. stores stocks in a stack

1.DBfwd uses StockNode. Write the minimum StockNode definition for this purpose. (hint: StockNode is a Stock)

2. Write insert_back member function for DBfwd assuming first is the only data members of the list.

void DBfwd::insert_back(StockNode s) {

3.Write the minimum DBdlink.h (just data members, no need to write function members)

class DBdlink {

public:

4. Continue with your minimum DBdlink.h, write delete_back member function for DBdlink which returns last node in parameter.

void DBdlink::delete_back(StockNode& last) {

5. Assume DBstack is implemented with a dynamic array, write the minimum and complete DBstack.h with push and pop functions.

class DBstack {

public:

6. The postfix notation representation of a math expression 2 * ( 3 - 4 ) / ( 5 + 6 )

Its postfix notation representation is ___________________________________

(use the space below as your scratchpad so we know the answer is genuine.)

7. What are the two must-have conditions for a recursive algorithm?

_________________________________________

__________________________________________

8. Write a recursive reverse_print function for DBfwd assuming first is the only data members of the list. You can also assume Stock has operator << overload and StockNode is a Stock.

void DBfwd::reverse_print() {

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

=+ a. A change in consumer preferences increases the saving rate.

Answered: 1 week ago