Question: in c++ Programming Assignment Create IntList.h and IntList.cpp as specified below. Use the NumberList class (described in the textbook and available on Moodle) as a

in c++

in c++ Programming Assignment Create IntList.h and IntList.cpp as specified below. Usethe NumberList class (described in the textbook and available on Moodle) asa starting point for writing your IntList class. You may not useany Standard Template Library containers (such as list or forward_list).. Also createa Lab18a.cpp source code file. This file contains the "main()" function. ClassSpecification File (IntList.h) In the IntList.h file, declare a class named IntList.The class must declare a s truct for a linked list of

Programming Assignment Create IntList.h and IntList.cpp as specified below. Use the NumberList class (described in the textbook and available on Moodle) as a starting point for writing your IntList class. You may not use any Standard Template Library containers (such as list or forward_list).. Also create a Lab18a.cpp source code file. This file contains the "main()" function. Class Specification File (IntList.h) In the IntList.h file, declare a class named IntList. The class must declare a s truct for a linked list of integers: struct ListNode \{ int value; struct ListNode *next; \} The IntList class must contain a member variable that is a pointer to ListNode: ListNode *head; // List head pointer The IntList class must define a constructor that takes no arguments and sets the head member variable to the nullptr pointer value. The IntList class must also declare function prototypes for the following member functions: Class Implementation File (IntList.cpp) The IntIist. cpp file must contain code for all of the functions declared in IntIist. h. Interactive "Main" Program In the main function, implement an interactive command-loop similar to those we have used in other labs. (Feel free to copy/paste from other labs if you wish.) Interactive Commands The program must support the following commands: a APPEND a new node at the end of the list c COUNT the nodes in the list (display the list length). d DELETE a node from the list i INSERT a node into the list, maintaining the sorted order. m display the MAXIMUM (largest) value in the list. p PRINT the contents of the list on the console. Format the output as shown in the Sample Output section of this document. That is, the output must include the memory address of each node, the value field, and the value of the next pointer. (We should be able to look at the console output and follow the links from one node to the next in the list.) h HELP text q QUIT (end the program) t display the TOTAL (sum) of all values in the list. The APPEND, DELETE, and INSERT commands must prompt the user to enter an integer value. If the list is empty, the MAXIMUM command must display a "List is empty" message. Sample Output In the sample session shown (below and on the following pages), the text that the user types is shown in bold font. In actuality, all text appears in the same font. (As always, the exact memory addresses of dynamically allocated memory is potentially different each time the program runs.) Sample Input / Output Command: h Supported commands: a APPEND a value to the list. c COUNT the nodes in the list (display LENGTH of the list). d DELETE a value from the list. i INSERT a value into the list. m display maximum (largest) value in the list. p PRINT the list contents. h print this help text. q quit (end the program). t display total (sum) of all values in the list. Sample Input / Output Command: m List is empty. Command: t Total of all list values =0. Command: i Enter number to insert into the list: 12 Command: i Enter number to insert into the list: 4 Command: i Enter number to insert into the list: 32 Command: p head =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181990 000001C373181990: value =12 next =000001C373181F30 000001C373181F30 : value =32 next =000000000000000 Command: a Enter number to append to the list: 5 Command: p head =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181990 000001C373181990: value =12 next =000001C373181F30 000001C373181F30: value =32next=000001C3731813F0 000001C3731813F0: value =5 next =0000000000000000 Command: m Maximum value in list =32 Command: t Total of all list values =53. Command: d Enter number to delete from the list: 5 Command: t Total of all list values =48. Command: m Maximum value in list =32 Sample Input / Output Command: p head =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181990 000001C373181990: value =12next=000001C373181F30 000001C373181F30 : value =32 next =000000000000000 Command: i Enter number to insert into the list: 23 Command: i Enter number to insert into the list: 9 Command: C Length of list =5 nodes Command: p head =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530 : value =9 next =000001C373181990 000001C373181990: value =12 next =000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 000001C373181F30 : value =32 next =0000000000000000 Command: i Enter number to insert into the list: 2 Command: p head =000001C373181FD0 000001C373181FD0: value =2 next =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530 : value =9 next =000001C373181990 000001C373181990: value =12 next =000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 000001C373181F30: value =32 next =0000000000000000 Command: i Enter number to insert into the list: 65 Command: p head =000001C373181FD0 000001C373181FD0: value =2 next =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530 : value =9 next =000001C373181990 000001C373181990: value =12 next =000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 000001C373181F30: value =32 next =000001C373181850 000001C373181850 : value =65 next =000000000000000 Command: C Length of list =7 nodes Sample Input / Output Command: In Maximum value in list =65 Command: t Total of all list values =147. Command: d Enter number to delete from the list: 12 Command: p head =000001C373181FD0 000001C373181FD0: value =2 next =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530: value =9 next =000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 000001C373181F30: value =32 next =000001C373181850 000001C373181850 : value =65 next =0000000000000000 Command: C Length of list =6 nodes Command: d Enter number to delete from the list: 8 Data value 8 not found. Command: p head =000001C373181FD0 000001C373181FD0: value =2next=000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530: value =9 next =000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 000001C373181F30: value =32next=000001C373181850 000001C373181850 : value =65 next =000000000000000 Command: d Enter number to delete from the list: 2 Command: p head =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530: value =9 next =000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 000001C373181F30: value =32next=000001C373181850 000001C373181850 : value =65 next =000000000000000 Command: d Enter number to delete from the list: 65 Sample Input / Output Command: p head =000001 C 373181 CB0 000001C373181CB0: value =4 next =000001C373181530 000001C373181530: value =9next=000001C3731816C0 000001C3731816C0: value =23 next =000001C373181F30 Command: C Length of list =4 nodes Command: m Maximum value in list =32 Command: t Total of all list values =68. Command: d Enter number to delete from the list: 32 Command: p head =000001C373181CB0 000001C373181CB0: value =4 next =000001C373181530 000001C3731816C0: value =23 next =000000000000000 Command: m Maximum value in list =23 Command: t Total of all list values =36. Command: d Enter number to delete from the list: 4 Command: p head =000001C373181530 000001C3731816C0 : value =23 next =000000000000000 Command: C Length of list =2 nodes Command: t Total of all list values =32. Command: m Maximum value in list =23 Command: d Sample Input / Output Enter number to delete from the list: 9 Command: C Length of list =1 nodes Command: p head =000001C3731816C0 000001C3731816C0: value =23 next =0000000000000000 Command: d Enter number to delete from the list: 23 Command: C Length of list =0 nodes Command: m List is empty. Command: q Exiting program with status =0 If your program is working correctly, then your results should be the same as shown in the Sample Input/Output above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!