Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Loyola University of Chicago Queue Class and C Programming Lab Report

Loyola University of Chicago Queue Class and C Programming Lab Report

Question Description

I’m working on a c++ question and need a sample draft to help me understand better.

Generics

Part 1: Queue Class

For this part, you must create a Queue Class. A queue is similar to a stack (what the FILO class that we went over in class). A queue is FIFO (first in first out). You can think of a queue as a checkout line in a store. When you add to the queue, you add to the end of it. When you remove from the queue, you remove from the front, and everyone moves up one spot.

The properties that your queue class must have is the following:

  • int size – how many elements are currently in the queue
  • int max_size – how many total elements can the queue hold
  • T* queue – the array representing our queue
  • void enqueue(T&) – place T at the end of the queue
  • T& dequeue() – return the element at the front of the queue, remove it from queue, and move all elements up one spot. (can return T instead of T& if you choose to do that)
  • T& peek() – return the element at the front of the queue, but don’t update the rest of the queue.
  • bool isEmpty() – returns true if queue is empty. False otherwise.
  • int size() – return how many elements are in the queue.
  • Operator<< – output the entire queue in the following format
  • 1) element1, 2) element2, etc.
  • Operator<< can be replaced with a print function that prints out the contents of the queue to cout, or a to_string function that returns a string with the contents of the queue.

Part 2: main

In you main, create 2 queues, each one containing different types. Add several elements to each one. Then print each queue to terminal. Then remove some elements from each list, printing out each element you remove. Then print each queue again. Lastly, print out the first element in queue.

Threads

You will be creating a program to simulate depositing and withdrawing money into a bank account. This homework will not require any objects.

  • The account balance will be stored in a global variable.
  • The function account transaction (double amount) will print out the balance, change the account balance by the amount (can be positive or negative), then print out the new balance. This function must be able to handle simultaneous transactions and always give the correct result.

The main function will do the following:

  • Set the account balance to the beginning balance (You choose the amount)
  • Print out the beginning balance
  • Add two amounts to the account balance and remove two amounts from the balance (You choose the amounts). The transactions must happen simultaneously as threads
  • Print the final balance after all transactions have finished and joined back to main.

Execution

Your program must run when the following command is typed in.

For generics, use this command: g++ -std=c++17 abc1234_generics_main.cpp

For threads, use this command: g++ -std=c++17 abc1234_threads_main.cpp -pthread

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Executive Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Executive Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Executive Papers is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Executive Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.