Concept explainers
For this assignment, you are to use the started code provided with QUEUE Container Adapter methods and provide the implementation of a requested functionality outlined below.
Scenario:
A local restaurant has hired you to develop an application that will manage customer orders. Each order will be put in the queue and will be called on a first come first served bases.
Develop the menu driven application with the following menu items:
- Add order
- Next order
- Previous order
- Delete order
- Order Size
- View order list
- View current order
Order management will be resolved by utilization of an STL-queue container’s functionalities and use of the following Queue container adapter functions:
- enQueue: Adds the order in the queue
- DeQueue: Deletes the order from the queue
- Peek: Returns the order that is top in the queue without removing it
- IsEmpty: checks do we have any orders in the queue
- Size: returns the number of orders that are in the queue
While adding a new order in the queue, the program will be capable of collecting the following order information:
- Name on order
- Order description
- Order total
- Order tip
- Date of order
The started code:
#include <iostream>
#include <queue>
#include <string>
using namespace std;
class patient {
/ /Creates class for patient variable
public:
string firstName;
string insuranceType;
string lastName;
string ssn;
string address;
string visitDate;
};
queue <patient> p;
void enqueue()
//Enqueues patient details from console input
{
patient pa;
cout << "Please enter Patient First Name:";
cin >> pa.firstName;
cout << "Please enter Patient Last Name:";
cin >> pa.lastName;
cout << "Please enter Patient insurance type:";
cin >> pa.insuranceType;
cout << "Please enter Patient SSN:";
cin >> pa.ssn;
cout << "Please enter Patient Address:";
cin.ignore();
getline(cin, pa.address);
cout << "Please enter Patient Date of Visit:";
cin >> pa.visitDate; p.push(pa);
}
patient dequeue()
//Removes patient from queue
{
patient pa;
if (!p.empty()) {
pa = p.front();
p.pop();
}
return pa;
}
void peek()
//Returns current patient at the front of the queue
{
if (!p.empty()) {
patient tmp = p.front();
cout << "Patient Name is " << tmp.firstName<< endl;
}
}
int main() {
int x = 0;
int n;
patient last;
while (x == 0) {
//Prompts for Menu Selection while selection = 0, which is defaulted to 0
cout << "Welcome to Dental Associates of Kansas City" << endl; cout << "**************************************************" << endl;
cout << "To get started, please select an option from the menu below:" << endl;
cout << "1. Add patient" << endl;
cout << "2. Next patient" << endl;
cout << "3. Previous patient" << endl;
cout << "4. Delete patient" << endl;
cout << "5. View current" << endl;
cout << "6. Exit this program" << endl; cout << "Enter the number of the action you would like to perform: ";
cin >> n; if (n == 1) {
enqueue();
} else if (n == 2) {
last = dequeue();
peek();
} else if (n == 3) {
cout << last.firstName << endl;
} else if (n == 4) {
last = dequeue();
} else if (n == 5) {
peek();
} else if (n == 6) {
exit(0);
}
}
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- The code given below represents a saveTransaction() method which is used to save data to a database from the Java program. Given the classes in the image as well as an image of the screen which will call the function, modify the given code so that it loops through the items again, this time as it loops through you are to insert the data into the salesdetails table, note that the SalesNumber from the AUTO-INCREMENT field from above is to be inserted here with each record being placed into the salesdetails table. Finally, as you loop through the items the product table must be update because as products are sold the onhand field in the products table must be updated. When multiple tables are to be updated with related data, you should wrap it into a DMBS transaction. The schema for the database is also depicted. public class PosDAO { private Connection connection; public PosDAO(Connection connection) { this.connection = connection; } public void…arrow_forwarddef upgrade_stations(threshold: int, num_bikes: int, stations: List["Station"]) -> int: """Modify each station in stations that has a capacity that is less than threshold by adding num_bikes to the capacity and bikes available counts. Modify each station at most once. Return the total number of bikes that were added to the bike share network. Precondition: num_bikes >= 0 >>> handout_copy = [HANDOUT_STATIONS[0][:], HANDOUT_STATIONS[1][:]] >>> upgrade_stations(25, 5, handout_copy) 5 >>> handout_copy[0] == HANDOUT_STATIONS[0] True >>> handout_copy[1] == [7001, 'Lower Jarvis St SMART / The Esplanade', \ 43.647992, -79.370907, 20, 10, 10] True """arrow_forwardUsing Java, create a personal directory that contains a data structure for first name, last name, email address and phone number. The data structure should be able to contain the information for an unlimited number of people (depending on system resources).• The program interface should consist of a menu that provides the user with ways to (at least):▪ Add: Get data from user and add the data to the structure.▪ View: which will view the current data in the directory ▪ Edit/Update: Edit existing data ▪ Remove: Delete an entry▪ Search: which prompts the user for search criteria (program should be smart enough to know how to tell what kind of data is being searched for. Try to make this as versatile as possible). Display the data if found. If not found add the new information to the data structure (you must provide the right input for this).The program should store the data in a file so that the program can be run whenever the user wants, even after closing.• Your program should:▪ Contain…arrow_forward
- /* Created with SQL Script Builder v.1.5 */ /* Type of SQL : SQL Server */ CREATE TABLE EMPLOYEE ( EMP_CODE int, EMP_TITLE varchar(4), EMP_LNAME varchar(15), EMP_FNAME varchar(15), EMP_INITIAL varchar(1), EMP_DOB datetime, JOB_CODE varchar(5), STORE_CODE int ); INSERT INTO EMPLOYEE VALUES('1','Mr.','Williamson','John','W','5/21/1964','SEC','3'); INSERT INTO EMPLOYEE VALUES('2','Ms.','Ratula','Nancy','','2/9/1969','MGR','2'); INSERT INTO EMPLOYEE VALUES('3','Ms.','Greenboro','Lottie','R','10/2/1961','GEN','4'); INSERT INTO EMPLOYEE VALUES('4','Mrs.','Rumpersfro','Jennie','S','6/1/1971','GEN','5'); INSERT INTO EMPLOYEE VALUES('5','Mr.','Smith','Robert','L','11/23/1959','GEN','3'); INSERT INTO EMPLOYEE VALUES('6','Mr.','Renselaer','Cary','A','12/25/1965','GEN','1'); INSERT INTO EMPLOYEE VALUES('7','Mr.','Ogallo','Roberto','S','7/31/1962','MGR','3'); INSERT INTO EMPLOYEE VALUES('8','Ms.','Johnsson','Elizabeth','I','9/10/1968','SEC','1'); INSERT INTO EMPLOYEE…arrow_forwardWrite the parameterList for a procedure that receives a Decimal value followed by the address of a Decimal variable. Use decSales and decBonus as the parameter names.arrow_forwardYou are writing an application for the 911 dispacher office for a city. You need a data structure that will allow you to store all the residents' phone numbers and addresses. The common operations performed on the set of objects are: lookup an address based on the calling phone number. The client wants the program to be as efficient as possible. Which of the following data structures should you use in your design? Question 43 options: Hash table Binary search tree Heap Sorted linked Listarrow_forward
- A declared name is only valid within a region of code known as the name's scope. Example: A variable “globalVar_1” declared in main() is only valid within main(), from the declaration to main()'s end. True or falsearrow_forwardLook at the code below and use the following comments to incdicate the scope of the static variables or functions. Place the comment below the relevant line. Module scope Class scope Function scope The code runs. Use onlinegdb.com to see it run. Module scope means global but only known in this source file. Class scope means global but only known by the class. Function scope means global but only known in the function. Hide Comments 1 #include 2 static const int MAX_SIZE=10; 5 // Return the max value 6 static double max(double d1) 7 { static double lastMax = 0; lastMax = (di > lastMax) ? di : lastMax; return lastMax; 8 10 11 } 12 13 // singleton class only one instance allowed 14 class singleton 15 { public: static Singleton& getsingleton() { return theone; } // Returns the Singleton 16 17 18 19 20 friend std::ostream& operator<< (std::ostream& o, const Singleton& s); private: Singleton() { }; // Prevents more instances 21 22 23 24 25 static Singleton theone; 26 }; 27 Singleton…arrow_forward/* Created with SQL Script Builder v.1.5 */ /* Type of SQL : SQL Server */ CREATE TABLE EMPLOYEE ( EMP_CODE int, EMP_TITLE varchar(4), EMP_LNAME varchar(15), EMP_FNAME varchar(15), EMP_INITIAL varchar(1), EMP_DOB datetime, JOB_CODE varchar(5), STORE_CODE int ); INSERT INTO EMPLOYEE VALUES('1','Mr.','Williamson','John','W','5/21/1964','SEC','3'); INSERT INTO EMPLOYEE VALUES('2','Ms.','Ratula','Nancy','','2/9/1969','MGR','2'); INSERT INTO EMPLOYEE VALUES('3','Ms.','Greenboro','Lottie','R','10/2/1961','GEN','4'); INSERT INTO EMPLOYEE VALUES('4','Mrs.','Rumpersfro','Jennie','S','6/1/1971','GEN','5'); INSERT INTO EMPLOYEE VALUES('5','Mr.','Smith','Robert','L','11/23/1959','GEN','3'); INSERT INTO EMPLOYEE VALUES('6','Mr.','Renselaer','Cary','A','12/25/1965','GEN','1'); INSERT INTO EMPLOYEE VALUES('7','Mr.','Ogallo','Roberto','S','7/31/1962','MGR','3'); INSERT INTO EMPLOYEE VALUES('8','Ms.','Johnsson','Elizabeth','I','9/10/1968','SEC','1'); INSERT INTO EMPLOYEE…arrow_forward
- write a program for a library automation which gets the isbn number, name, author and publication year of the books in the library. the status will be filled by the program as follows: if publication year before 1985 the status is reference else status is available, the information about the books should be stored inside a linked list. the program should have a menu and the user inserts, displays, and deletes the elements from the menu by write a selecting options. the following data structure should be used. struct list char isbn[ 20 ]: char namei 20 ]. char authori 20 ]: int year; char status[200j: struct list "next, jinfo, wedoad n un posn ag pinogs nuu sulnogoj l press 1. to insert a book press 2. to display the book list press 3. to delete a book from listarrow_forwardIn the following pseudocode of creating a trigger, the first UPDATE is the ____ of the trigger, and the second UPDATE is the ____ of the trigger. CREATE TRIGGER MyTrigger AFTER UPDATE OF attr ON MyTable ... WHEN ... UPDATE MyTable .... Group of answer choices Action; action Condition; action Event; action Event; conditionarrow_forwardUse the started code provided with QUEUE Container Adapter methods and provide the implementation of a requested functionality outlined below. This program has to be in c++, and have to use the already started code below. Scenario: A local restaurant has hired you to develop an application that will manage customer orders. Each order will be put in the queue and will be called on a first come first served bases. Develop the menu driven application with the following menu items: Add order Next order Previous order Delete order Order Size View order list View current order Order management will be resolved by utilization of an STL-queue container’s functionalities and use of the following Queue container adapter functions: enQueue: Adds the order in the queue DeQueue: Deletes the order from the queue Peek: Returns the order that is top in the queue without removing it IsEmpty: checks do we have any orders in the queue Size: returns the number of orders that are in the queue…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education