In C++ Somewhere on the net, you find a lovely little class designed to help manage a list of temperature values. You think it could be a decent basis for more general purposes, so you download it and begin your enhancements. Here are the links, in case you forgot to bookmark them (*grin*): http://craie-programming.org/122/projects/TempList.h.html http://craie-programming.org/122/projects/TempList.C.html First you'll need to remove all specific references to 'temperature' to make it a genericlist of double data. This may require changes to identifiers, strings, etc. in various places. Next add a method called get_lastwith no input to return [a copy of] the last item currently in the list. (Note that this will not change the list's contents...) Now add a method called delete_last. It will remove the last item from the list. It can be a pure void function — no inputs and no output. (But this one, does change the list's contents! In particular, don't forget to update the sizemember variable...oh, that's how you remove it, isn't it? *silly Jason*) If get_lastis called by an empty list object, you may return 0.0or NaN. If delete_lastis called by an empty list object, you may simply ignore the attempt. As a final upgrade from the temperature list, you decide you should make the listmember variable dynamic instead of 'static'. You'll need to pass the number of items to be in the list to the constructor and an extra member variable to track the size. (I'd rename the current member variable something like physical_sizeand call this new one logical_size, but any reasonable pair of names will do...) Remember where NULL checks should be placed. Don't forget your destructor! (And with that, don't forget your copy constructor and your operator=...)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In C++

Somewhere on the net, you find a lovely little class designed to help manage a list of temperature values. You think it could be a decent basis for more general purposes, so you download it and begin your enhancements. Here are the links, in case you forgot to bookmark them (*grin*):

  • http://craie-programming.org/122/projects/TempList.h.html

  • http://craie-programming.org/122/projects/TempList.C.html

First you'll need to remove all specific references to 'temperature' to make it a genericlist of double data. This may require changes to identifiers, strings, etc. in various places.

Next add a method called get_lastwith no input to return [a copy of] the last item currently in the list. (Note that this will not change the list's contents...)

Now add a method called delete_last. It will remove the last item from the list. It can be a pure void function — no inputs and no output. (But this one, does change the list's contents! In particular, don't forget to update the sizemember variable...oh, that's how you remove it, isn't it? *silly Jason*)

If get_lastis called by an empty list object, you may return 0.0or NaN. If delete_lastis called by an empty list object, you may simply ignore the attempt.

As a final upgrade from the temperature list, you decide you should make the listmember variable dynamic instead of 'static'. You'll need to pass the number of items to be in the list to the constructor and an extra member variable to track the size. (I'd rename the current member variable something like physical_sizeand call this new one logical_size, but any reasonable pair of names will do...)

Remember where NULL checks should be placed. Don't forget your destructor! (And with that, don't forget your copy constructor and your operator=...)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education