Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A harder version of Programming Project 4 would be to write a class named List, similar to Project 4, but with all the following member

A harder version of Programming Project 4 would be to write a class named List, similar to Project 4, but with all the following member functions:

Default constructor, List();

double List::front();, which returns the first item in the list

double List::back();, which returns the last item in the list

double List::current();, which returns the current item

void List::advance();, which advances the item that current() returns

void List::reset(); to make current() return the first item in the list

void List::insert(double after_me, double insert_me);, which inserts insert_me into the list after after_me and increments the private: variable count.

int size();, which returns the number of items in the list

friend istream& operator

The private data members should include the following:

node* head;

node* current;

int count;

and possibly one more pointer.

You will need the following struct (outside the list class) for the linked list nodes:

struct node

{

double item;

node *next;

};

Incremental development is essential to all projects of any size, and this is no exception. Write the definition for the List class, but do not implement any members yet. Place this class definition in a file list.h. Then #include "list.h" in a file that contains int main(){}.Compile your file. This will find syntax errors and many typographical errors that would cause untold difficulty if you attempted to implement members without this check. Then you should implement and compile one member at a time, until you have enough to write test code in your main function.

Same problem below in picture format

image text in transcribed

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago