Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with getting this code to print using c++ #ifndef PRIORITYLIST_H_ #d

ID: 3740759 • Letter: I

Question

I need help with getting this code to print using c++

#ifndef PRIORITYLIST_H_
#define PRIORITYLIST_H_

#include <vector>
#include <iostream>
#include <stdexcept>

template<class E>
class PriorityList {

private:
std::vector<E> elements;
int n; // number of elements in vector

public:
// Construct an empty PriorityList with the capacity to store 20 elements
PriorityList()
{

}

// Return the number of elements currently in this PriorityList
int size()
{

}

// Return true if size() == 0 or false if size() > 0
bool isEmpty()
{

}

// Insert the element at the given index.
// precondition: index is on the range of 0 through size()
void insertElementAt(int index, E el)
{

}

// Return a reference to the element at the given index.
// precondition: index is on the range of 0 through size()-1
E getElementAt(int index)
{

}

// Remove the element at the given index.
// precondition: index is on the range of 0 through size()-1
void removeElementAt(int index)
{

}

// Swap the element located at index with the element at index+1.
// An attempt to lower the priority of the element at index size()-1 has no effect.
// precondition: index is on the range of 0 through size()
void lowerPriorityOf(int index)
{

}

// Swap the element located at index with the element at index-1.
// An attempt to raise the priority at index 0 has no effect.
// precondition: index is on the range of 0 through size()
void raisePriorityOf(int index)
{

}

// Move the element at the given index to the end of this list.
// An attempt to move the last element to the last has no effect.
// precondition: index is on the range of 0 through size()-1
void moveToLast(int index)
{

}

// Move the element at the given index to the front of this list.
// An attempt to move the top element to the top has no effect.
// precondition: index is on the range of 0 through size()-1
void moveToTop(int index)
{

}

};

#endif /* PRIORITYLIST_H_ */

Output:

Student Name, CIS127, Activity 11.2 - 11D

Insert elements a, b, c, d:
a b c d
Insert element f:
a f b c d
Remove first element:
f b c d
Lower element f:
b c d f
Raise element d:
d b c f
Make element d last:
b c f d
Make element f first:
f b c d

Explanation / Answer

The program is ended with exisiting code o

while im compiling the code

#ifndef PRIORITYLIST_H_
#define PRIORITYLIST_H_

#include <vector>
#include <iostream>
#include <stdexcept>

template<class E>
class PriorityList {

private:
std::vector<E> elements;
int n; // number of elements in vector

public:
// Construct an empty PriorityList with the capacity to store 20 elements
PriorityList()
{

}

// Return the number of elements currently in this PriorityList
int size()
{

}

// Return true if size() == 0 or false if size() > 0
bool isEmpty()
{

}

// Insert the element at the given index.
// precondition: index is on the range of 0 through size()
void insertElementAt(int index, E el)
{

}

// Return a reference to the element at the given index.
// precondition: index is on the range of 0 through size()-1
E getElementAt(int index)
{

}

// Remove the element at the given index.
// precondition: index is on the range of 0 through size()-1
void removeElementAt(int index)
{

}

// Swap the element located at index with the element at index+1.
// An attempt to lower the priority of the element at index size()-1 has no effect.
// precondition: index is on the range of 0 through size()
void lowerPriorityOf(int index)
{

}

// Swap the element located at index with the element at index-1.
// An attempt to raise the priority at index 0 has no effect.
// precondition: index is on the range of 0 through size()
void raisePriorityOf(int index)
{

}

// Move the element at the given index to the end of this list.
// An attempt to move the last element to the last has no effect.
// precondition: index is on the range of 0 through size()-1
void moveToLast(int index)
{

}

// Move the element at the given index to the front of this list.
// An attempt to move the top element to the top has no effect.
// precondition: index is on the range of 0 through size()-1
void moveToTop(int index)
{

}

};

#endif /* PRIORITYLIST_H_ */

Output:

Student Name, CIS127, Activity 11.2 - 11D

Insert elements a, b, c, d:
a b c d
Insert element f:
a f b c d
Remove first element:
f b c d
Lower element f:
b c d f
Raise element d:
d b c f
Make element d last:
b c f d
Make element f first:
f b c d

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote