Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the main.cpp For this assignment complete the following requirements in order: 1. (5 pts) You must take a screen shot or picture of

image text in transcribedimage text in transcribedimage text in transcribed

Here is the main.cpp

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

For this assignment complete the following requirements in order: 1. (5 pts) You must take a screen shot or picture of the syntax errors listed in the initial code after you build the code with cmake in the Linux terminal. This should demonstrate that you are using a Linux environment. The picture should end up in a .pdf file in your MA1 folder. Make sure your CMakeLists.txt contains the following set commands: set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_BUILD_TYPE Debug) 2. (15 pts) You are required to fix all syntax and build errors. If the error is directly related to an environment specific condition (i.e. only works on Linux, but not Windows), then comment out the statement causing the problem. You do NOT need to find an equivalent fix for the other environment. 3. (45 pts - 5 pts/test case) Once you have fixed all syntax and build errors, you are required to write unit tests for all functions or units, excluding main (), the constructor, and the destructor, in the project. Your objective is to achieve 100% branch coverage for each unit. For each unit test you are required to construct a comment block with the information described in the background section What is a test case?", and implement a test function for the corresponding test case. Each test function must have a function declaration that is placed in a file called testQueue.h or testQueue.hpp and all test function definitions and comment blocks must be placed in a file called testQueue.cpp. A test function should always be declared as void testFunctionName (void). This means we want these tests to be self-contained. They do not accept any arguments and do not return any results. All setup and evaluation for the test is done inside the function. Hint: you will need 1 test case for each of the following functions: queue::size() queue::isEmpty () Hint: you will need 1 test case for each of the following functions: queue::size() queue::isEmpty 0 queue::isFull (), you will need 2 test cases for the following: queue::dequeue queue::enqueue () queue::peek () Call your test functions from main (). At this point do NOT fix the bugs discovered! This will be done as part of the next step! Place the results of each test case, i.e. pass or fail in the same comment block as the test case comment block. 4. (20 pts) Fix all bugs revealed by your test cases. Show a screen shot or picture of one break point that you have added to a unit to debug, where the bug was identified by one of your test cases. The debugger used must be a Linux tool (gbd, CLion, or VS Code)! The picture should end up in a .pdf file. 5. (15 pts - 3 pts/attribute) Using your understanding of design choices, software principles, and coding standards, which we will group under the general label "attributes" - list and describe 5 attributes demonstrated by the code that you would consider poor. These should NOT be related to the syntax errors. Examples of poor attributes could be related to comments, file structure, data structure selection, algorithm efficiency, etc. Place your list in a comment block at the top of the main.cpp file. #include #include using namespace std; // define default capacity of the queue #define SIZE 10 // Class for queue class queue { int* arr; int capacity; int front; int rear; int count; // array to store queue elements // maximum capacity of the queue // front points to front element in the queue (if any) // rear points to last element in the queue // current size of the queue = // constructor // destructor public: queue(int size SIZE); -queue(); void dequeue(); void enqueue(int x); int peek(); int size(); bool isEmpty(); bool isFull(); bool isEmpty(); bool isFull); } // Constructor to initialize queue queue::queue(int size) { arr = new int[size]; capacity = size; front = 0; rear = -1; count = 0; } // Destructor to free memory allocated to the queue queue::-queue { delete arr; Il you are not required to test this function; 1/ however, are there issues with it? } // Utility function to remove front element from the queue void queue::dequeue() { Il check for queue underflow if (isEmpty) } // Utility function to remove front element from the queue void queue::dequeue() { // check for queue underflow if (isEmpty() { cout #include using namespace std; // define default capacity of the queue #define SIZE 10 // Class for queue class queue { int* arr; int capacity; int front; int rear; int count; // array to store queue elements // maximum capacity of the queue // front points to front element in the queue (if any) // rear points to last element in the queue // current size of the queue = // constructor // destructor public: queue(int size SIZE); -queue(); void dequeue(); void enqueue(int x); int peek(); int size(); bool isEmpty(); bool isFull(); bool isEmpty(); bool isFull); } // Constructor to initialize queue queue::queue(int size) { arr = new int[size]; capacity = size; front = 0; rear = -1; count = 0; } // Destructor to free memory allocated to the queue queue::-queue { delete arr; Il you are not required to test this function; 1/ however, are there issues with it? } // Utility function to remove front element from the queue void queue::dequeue() { Il check for queue underflow if (isEmpty) } // Utility function to remove front element from the queue void queue::dequeue() { // check for queue underflow if (isEmpty() { cout

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 3 Lnai 9853

Authors: Bettina Berendt ,Bjorn Bringmann ,Elisa Fromont ,Gemma Garriga ,Pauli Miettinen ,Nikolaj Tatti ,Volker Tresp

1st Edition

3319461303, 978-3319461304

More Books

Students also viewed these Databases questions