Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will submit three files: A simple test program for your List class -- your test program must use at least the test case shown

image text in transcribed

You will submit three files:

A simple test program for your List class -- your test program must use at least the test case shown below

Your List class header file

Your List class implementation file

This implementation of the List class needs an internal member that is an array. The member functions will need to know how many values that array can hold and take care not to overflow the array. The solution below has an internal limit of 50 values. (FYI, we will revisit this same problem in a future lesson when we learn about dynamically expanding arrays, and will implement a better version that has no inherent limit.)

Here is the core of a simple test program for a list class object.

// First add some data

for (int i = 0; i

{

cout

cin >> temp;

testList.addValue(temp);

}

// Exercise member functions

cout

cout

cout

testList.deleteLast();

cout

cout

while (!testList.full())

{

testList.addValue(100.0);

}

cout Define a class called List that can hold a list of values of type double. Model your class definition after the class TemperatureList given in Display 11.10, but your class List will make no reference to temperatures when it outputs values. The values may represent any soil of data items as long as they are of type double. Include the additional features specified in Self-Test Exercises 21 and 22. Change die member function names so that they do not refer to temperature. Add a member function called get last that lakes no arguments and returns the last item on the list. The member function get last does not change the list, and it should not be called if the list is empty. Add another member function called delete_last that deletes the last element on the list The member function delete_last is a void function. Note that when the last element is deleted, the member variable size must be adjusted. If delete_last is called with an empty list as the calling object, the function call has no effect. Design a program to thoroughly test your definition for the class List

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

More Books

Students also viewed these Databases questions