Write a C++ program to simulate a library desk with book bins placed on it. A book is returned by placing (stacking) it in a random book bin on the library desk. You might use a vector of stacks....

Write a C++ program to simulate a library desk with book bins placed on it. A book is returned by placing (stacking) it in a random book bin on the library desk. You might use a vector of stacks. Assume that the day starts with three empty book bins on the desk. When two-third of the bins are full, more empty book bins are added to the desk, to double the number of existing bins, up to a maximum of twelve bins. When the desk is full, a function clear_desk() gets rid of all the book bins. The simulation then continues with three empty book bins, and the process continues.Your program should start by asking the user to input a value for duration (in seconds) between 60 seconds to 180 seconds. Simulation starts afterwards with the clock ticking. Simulation ends when the simulation clock time is over. If a bin is full, make sure to prevent stack overflow. o Maximum number of books per bin = 4 o Frequency of book returns = every 2 seconds. Assume one book is returned per time. o A complete round = Twelve full book bins, followed by an automated call to clear_desk( ) function. See “assignment 4 library simulation video” and/or “assignment 4 library simulation pages” for a picture of this assignment. You will find them on the course Moodle page, under Lecture Assignment 4 • See file titled “timer_example.cpp” for sample code that simulates time checking in a program loop. • Your code should include appropriate comments. All files (.h and .cpp) should include a comment at the top of the file, with your name, and a brief description of what the file is for. All functions should be properly documented in the header file, including PRECONDITIONS and POSTCONDITIONS. You do not need to include this in the function implementation as well. • All identifiers (function and variable names) should be meaningful. • Your code should have proper indentation and spacing. • Any object parameter should be passed by reference. Make sure to declare object inputs as const where appropriate. Functions which do not modify the object should be const. • Your program should start with a welcome message, then ask user for duration. o E.g., “Hello! Welcome to Aderonke’s (use your first name here) Library Bin Simulation! Please enter simulation duration:”
Mar 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here