ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 28 Apr 2017 My Price 8.00

LAB4 Linked Lists

LAB4 Linked Lists

Objectives

•Get yourself familiar with the forward linked list creation and operations

•Manipulate pointers

•Do NOT use any STL containers

Overview

1.We wish to maintain several stocks in a linked list.  Each stock has a stock symbol (STLstring), a cost (double, i.e. purchase price), the number of shares (int).  One needs apointer to the next node in the linked list.  There are at least the following three

approaches:

•Approach 1class stockNode {string symbol; double cost; int shares; stockNode *next; };

•Approach 2class stock {string symbol; double cost; int shares; };class stockNode {stock info; stockNode *next; };

•Approach 3class stock {string symbol; double cost; int shares; };class stockNode: public stock {stockNode *next; };

In this lab, please choose approach 2 or 3.

2.

Write a main program (lab4Main.cpp) that creates a forward linked list of at least 10elements, where each element holds a stock, without keeping track of list length.  Noneed to have a separate stockDB class.  This means the main program itself is equivalentto the stockDB class.  In the main program for each stock, you can hard-code a stocksymbol (or just do S1, S2, etc.), cost, and shares (or you can randomly generate any ofthese three).  Alternatively, you could choose to reading a stock file, which might beeasier.3.From the main program, print the list.4.Write the function "returnMiddleList" in the main program to find the middle elementof the linked list in one pass.•This function splits the input list in half at the middle element to create twoentirely separate output linked lists of near equal size (+/- 1).  In other words,

write the "split in half" function.

•For each of the following cases, print the two output lists

a.The input list is an empty list

b.The input list has only one element

c.The input list has odd number of elements (> 1)

 

d.The input list has even number of elements

Answers

(11)
Status NEW Posted 28 Apr 2017 02:04 AM My Price 8.00

-----------

Not Rated(0)