Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HW 3abc (3 Parts) HW 3a -Create an array-based UnsortedList data structure Write a program that implements an UnsortedList ADT. - The list will hold

image text in transcribed

image text in transcribed

image text in transcribed

HW 3abc (3 Parts) HW 3a -Create an array-based UnsortedList data structure Write a program that implements an UnsortedList ADT. - The list will hold up to 10 unsorted integer values. - When the list is initially created, it should be empty. Numbers can be inserted into the list (as long as the list is not full). Numbers can be deleted from the list (as long as the list is not empty). The list will be an array-based list. - Project: HW_3a 3 Files: UnsortedList.h UnsortedLIst.cpp main.cpp Note: Most of the code for this project is in the lecture notes. 1.) UnsortedList.h This file contains an UnsortedList class specification -Private data members: numbers - An array that holds integer values. Maximum number of items in the list is 10. (MAX SIZE 10) length - A variable to keep track of the length of the list. o - 6 Public methods Include these 6 methods: o Default constructor Sets the list to an empty list. o Destructor o insertItem An item is inserted into the list - An item (integer) is passed from main) to the function, and inserted at the end of the list. o deleteltem An item is deleted from the list. An item (integer) is passed from main) to the function. Starting at the beginning of the list, the item passed from main() is compared If the value from main() is equal to a value in the list, then the list item is If there is not an item in the list equal to the value from main), then an output - each item in the list. - deleted, and an output message should display: Item has been deleted. - message should display: Item is not in list. o isFull This method checks to see if the list is full. The function returns true if the list is full, and false if the list is not full. No parameters are passed from main). . .This method must be called before the insertltem method is called. The insertitem method is called only if the list is not full. o isEmpty This method checks to see if the list is empty. . The function returns true if the list is empty, and false if the list is not empty. " No parameters are passed from main). - This method must be called before the deleteltem method is called. The deleteltem method is called only if the list is not empty. 2.) UnsortedList.cpp This file contains the implementations of the six class methods. 3.) main.cpp This file contains main() Declare an unsorted list object in main0). Ex: UnsortedList list o In main0, call a showMenu function that displays a menu like this: a. Insert a number into the list b. Delete a number from the list. o In main) call a getChoice function that displays this: Enter your choice: a o If the choice is a, then prompt user to enter a number: Enter a number 12 o The list should be checked to determine if it is full. If not full, then insert the number into the list. If the choice is b, then prompt the user for the value to be deleted: o Enter the number to be deleted 4 The list should be checked to determine if it is empty. If not empty, search the list for the number. o " If the number is found, delete the number from the list, and display this " If the number is not found, display this message: Item is not in the list Then call showMenu again, then getChoice again, and so on... Use a while loop to continually show the menu and get the user's choice. message: Item has been deleted. o o -Make sure to insert more than 10 to test the isFull method. . When the list is full, display this message The list is ful1 - cannot insert the number. "Make sure to delete all of the numbers to test the isEmpty method . When the list is empty, display this message The list is empty

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

Students also viewed these Databases questions

Question

Define the term Working Capital Gap.

Answered: 1 week ago

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago