×
Reviews 4.9/5 Order Now

Create a Program to Implement Array Queue in C++ Assignment Solution

July 15, 2024
Ethan Patel
Ethan Patel
🇨🇦 Canada
C++
Prof. Ethan Patel, holding a master's degree in computer engineering from a leading Canadian institution, has completed over 900 orders in C++ assignments. Specializing in custom widget creation and advanced GUI design, he brings creativity and innovation to every Qt project, ensuring tailored solutions that exceed expectations.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Always follow object-oriented principles like encapsulation and inheritance. Break your code into small, reusable classes and methods. Use meaningful variable names, and always handle exceptions properly to avoid runtime errors. Don’t forget to test your code with different input cases before submission.
News
IntelliJ IDEA 2025.1.3 (released June 2025) brings essential bug fixes—better Dart test results view, AsyncAPI 3.0 previews, and improved Python/WSL support on ARM—smoothing the development workflow for Java, Kotlin, and Python students

Instructions

Objective

Write a program to implement array queue in C++.

Requirements and Specifications

Description: follow up the steps in assignment document and display output as assignment requirements. Must finished coding based on provided coding documents. I already have .h and .cpp file. Just need to complete the C++ assignment coding.

Source Code

// Created by Frank M. Carrano and Timothy M. Henry. // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. /** ADT queue: Circular array-based implementation. Listing 14-5. @file ArrayQueue.cpp */ #include "ArrayQueue.h" // Header file template ArrayQueue::ArrayQueue() : front(0), back(DEFAULT_CAPACITY - 1), count(0) { } // end default constructor template bool ArrayQueue::isEmpty() const { return count == 0; } // end isEmpty template bool ArrayQueue::enqueue(const ItemType& newEntry) { bool result = false; if (count < DEFAULT_CAPACITY) { // Queue has room for another item back = (back + 1) % DEFAULT_CAPACITY; items[back] = newEntry; count++; result = true; } // end if return result; } // end enqueue template bool ArrayQueue::dequeue() { bool result = false; if (!isEmpty()) { front = (front + 1) % DEFAULT_CAPACITY; count--; result = true; } // end if return result; } // end dequeue template ItemType ArrayQueue::peekFront() const throw(PrecondViolatedExcep) { // Enforce precondition if (isEmpty()) throw PrecondViolatedExcep("peekFront() called with empty queue"); // Queue is not empty; return front return items[front]; } // end peekFront // End of implementation file.

Related Samples

Explore our sample C++ programming samples to get a glimpse of our expertise in tackling complex coding challenges. From basic syntax to advanced algorithms, our solutions demonstrate clarity, efficiency, and adherence to best practices. Trust us to deliver top-notch assistance tailored to your academic needs.