Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ //================================= //sortedlist.h #include using namespace std; #ifndef SORTEDLIST_H #define SORTEDLIST_H const int SIZE = 10; class sortedList { private: int numbers[SIZE]; int length; public:

image text in transcribed

c++

//================================= //sortedlist.h #include using namespace std; #ifndef SORTEDLIST_H #define SORTEDLIST_H const int SIZE = 10; class sortedList { private: int numbers[SIZE]; int length; public: sortedList(); ~sortedList(); void insertItem(int num); void deleteItem(int num); bool isFull()const; bool isEmpty()const; }; #endif //================================ // sortedlist.cpp #include"sortedList.h" sortedList::sortedList() { length = 0; } sortedList::~sortedList() { } void sortedList::insertItem(int num) { } void sortedList::deleteItem(int num) { int first = 0; int midpoint = 0; int last = length - 1; } bool sortedList::isFull()const { if (length == SIZE - 1) return true; return false; } bool sortedList::isEmpty()const { if (length == 0) return true; return false; } //========================== // main.cpp #include"sortedList.h" void showMenu(); void getChoice(sortedList &list); int main() { sortedList list; do { showMenu(); getChoice(list); cout > choice; if (choice == 'a' || choice == 'A') { if (list.isFull()) cout > num; list.insertItem(num); } } else if (choice == 'b' || choice == 'B') { if (list.isEmpty()) cout > num; list.deleteItem(num); } } else if (choice == 'c' || choice == 'C') exit(0); else cout HW 3b-Array-based SortedList Write a program that uses a SortedList class to manago a sorted list of numbers. - The list will hold up to 10 integers - The numbers are sorted in ascending order (low to high). - When the list is initially created, it will 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). -One of the data members of the class is an array that will be used to hold the numbers. Project: HW 3b 3 Files: SortedList.h SortedLIst.cpp main.cpp Note: Comparing the UnsortedList to the SortedList, only the insertitem and deleteltem methods are different. Therefore, copy and paste your code from HW 4a and make changes to the insertitem and deleteltem methods. Include code to do a linear search for the insertitem method. Include code to do a binary search for the deleteltem method

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions