You will get email Reply within few hours

Tuesday 10 December 2013

Create a project in Visual C++ Express named Pass9


INSTRUCTIONS

Create a project in Visual C++ Express named Pass9.

Add eg141_NmberList.h and eg141_NumberList.cpp files to your project. These are included in the zip file with this document. The files implement a linked list of numbers.

Create and add pass9_demo.cpp to your project. This will have main() and use the eg141_NumberList class.

The purpose of this assignment is to add data members and methods to the eg141_NumberList class in order to give it more functionality.

Add the following to the eg141_NumberList class:

1. Add a method empty()

a. It should take no parameter.

b. It should return true if the list has no node, and false if there are 1 or more nodes.

2. Modify the displayList() method

a. If the list is empty, print “The list is empty”.

3. Add a method find()

a. It should take one parameter, a value.

b. It should go through the linked list. If the value is found, it should return the position of the value in the list.

i. If the value is in the first node, return 0. If the value is in the second node return 1, and so on.

ii. If the value is not found in the list return -1.

4. Add a method sum()

a. Return the sum of all the values in the list.

b. If the list is empty, return 0

5. Add a data member size.

a. The size represents the number of nodes in the linked list. Think of it as the length.

b. It should be an integer.

c. Add a method getSize() that returns the current value of size.

d. Whenever a new node is added to the linked list, the size should increase by one.

e. Whenever a node is deleted from the linked list, the size should decrease by one.

6. All methods should have prototypes in the eg141_NmberList.h file and implemented in the eg141_NmberList.cpp file.

The main() should do the following.

 Create a eg141_NumberList class to be used in the rest of the main().·

 Print the following menu·

1. Append a value

2. Insert a value

2 CSCI 2010

3. Delete a value

4. Print the list

5. Print the size

6. Print the list sum

7. Find a Number

8. Check if the list is empty

9. Exit

 Read the user’s choice and do the following. Use the appropriate methods in the eg141_NumberList class.·

o Option 4. Print all the existing nodes in the list.

o Option 1. Ask the user for a value, and append the value to the end of the list.

o Option 2. Ask the user for a value, and insert the value in the list.

o Option 3. Ask the user for a value, and delete it from the list.

o Option 4. Print all the nodes in the list.

o Option 5. Print the size of the list.

o Option 6. Print the sum of all the values in the list.

o Option 7. Prompt the user to enter a number, return the position if it is found.

o Option 8. Check if the list is empty.

o Option 9. Exit the program. The program should not quit until this option is selected. Use a loop that keeps printing the menu and asks for user menu selection.
Need Solution email me:

topsolutions8@gmail.com