L9A - Implementing a Queue F19 Lab#9A ImplementingaStack CS1B 1of4 Name1: _____________________________ Name2: _____________________________ Class Day / Time: _____________________________ Due...

1 answer below »
I need to get it in pdf so I can use it in the EClipse program, for Macbook version


L9A - Implementing a Queue F19 Lab#9A ImplementingaStack CS1B 1of4 Name1: _____________________________ Name2: _____________________________ Class Day / Time: _____________________________ Due Date: _____________________________ Lab #9A – Implementing a Queue Writeaprogramthatimplementsaqueueusingalinked-list. Writefunctionstoimplementeachofthefollowingtasks. - Enqueue - Dequeue - IsEmpty - Front - Size - ClearQueue Provideamenufortheusertochooseoneofthese6options(errorchecktheinputtoensureit isintheproperrange).Iftheychooseenqueueallowthemtoenterinaname,gender,andage. Iftheychoosetodequeue,letthemknowalltheinfoaboutthepersonwhoisbeingremoved (ifthelistisempty,letthemknow).Iftheyrequestthefront,showthemwhomareatthe frontofthelist.Iftheychoosesize,tellthemhowmanypeopleareinthelist.Iftheychoose clearqueueàemptythelist.Validatetheuserinput. Turn in as a single PDF file (IN THIS ORDER) 1. Your header file. 2. a listing of main.cpp (conforming to style discussed in class) 3. a listing of your print heading function (should be in a separate file) 4. a listing of your functions (in at least 1 separate file) 5. screen I/O – pasted into a text file within eclipse and output OUTPUTMESSAGEFORMAT Checkbelowforamoredetaileddescriptionoftheexpectedinputandoutput Invalidcommandinputs Outofrangeerror: ****Thenumber-1isaninvalidentry **** ****Pleaseinputanumberbetween0and6**** Characterinput: ****PleaseinputaNUMBERbetween0and6**** Size Formorethanone: There are 2 people in the queue. Forone: There is one person on the queue. Foranemptyqueue: Nobody is in the queue! Dequeue Ifthequeueisempty: Can't DEQUEUE from an empty list! IsEmpty Foranemptyqueue: Yes, the QUEUE is empty. Foranon-emptyqueue: The QUEUE is NOT empty. Front Ifthequeueisempty: Nobody in FRONT, the queue is empty!! ClearQueue Ifthequeueisempty: The QUEUE is ALREADY clear! 100 pts v.f.19 Lab#9A ImplementingaQueue CS1B 2of4 ExampleScreenInput/Outputshouldbeformattedasfollows QUEUEMENU: 1–ENQUEUE(Addaperson) 2–DEQUEUE(Removeaperson) 3–ISEMPTY(Isthequeueempty?) 4–FRONT(Whoisinfront?) 5–SIZE(Howmanypeoplearethere?) 6–CleartheQueue 0–Exit Enteracommand?1 Whowouldyouliketoadd? EnterName: GeorgeBoole EnterGender: M EnterAge: 32 Enteracommand?1 Whowouldyouliketoadd? EnterName: AdaLovelace EnterGender: F EnterAge: 21 Enteracommand?1 Whowouldyouliketoadd? EnterName: GraceHopper EnterGender: F EnterAge: 44 Enteracommand?4 Thefirstpersoninthequeueis: Name:GeorgeBoole Gender: M Age: 32 Enteracommand?5 Thereare3peopleinthequeue. Enteracommand?2 DEQUEUEING Name:GeorgeBoole Gender: M Age: 32 Enteracommand?5 Thereare2peopleinthequeue. Enteracommand?3 TheQUEUEisNOTempty Enteracommand?4 Thefirstpersoninthequeueis: Name: AdaLovelace Gender: F Age: 21 Enteracommand?2 DEQUEUEING Name: AdaLovelace Gender: F Age: 21 Lab#9A ImplementingaQueue CS1B 3of4 Enteracommand?5 Thereisonepersoninthequeue. Enteracommand?4 Thefirstpersoninthequeueis: Name: GraceHopper Gender: F Age: 44 Enteracommand?3 TheQUEUEisNOTempty. Enteracommand?2 DEQUEUEING Name: GraceHopper Gender: F Age: 44 Enteracommand?5 Nobodyisinthequeue! Enteracommand?4 NobodyinFRONT,thequeueisempty!! Enteracommand?3 Yes,theQUEUEisempty. Enteracommand?2 Can'tDEQUEUEfromanemptylist! Enteracommand?1 Whowouldyouliketoadd? EnterName: AlanTuring EnterGender: M EnterAge: 25 Enteracommand?1 Whowouldyouliketoadd? EnterName: BlaisePascal EnterGender: M EnterAge: 19 Enteracommand?1 Whowouldyouliketoadd? EnterName: DogBert EnterGender: M EnterAge: 3 Enteracommand?6 CLEARING… AlanTuring BlaisePascal DogBert ThequeuehasbeenCLEARED! Lab#9A ImplementingaQueue CS1B 4of4 redisplaymenu> Enteracommand?6 TheQUEUEisALREADYclear! Enteracommand?8 ****Thenumber12isaninvalidentry **** ****Pleaseinputanumberbetween0and6**** Enteracommand?a ****Pleaseinputanumberbetween0and6**** Enteracommand?0 rules 1. C++ language 2. Functions should be in separate files which is function.cpp 3. A listing of your print heading function (should be in a separate file) which is MyHeader.h 4. A listing of main.cpp 5. Program must use struct, DO NOT use class 6. Comment (documenting) is needed
Answered 1 days AfterApr 10, 2021

Answer To: L9A - Implementing a Queue F19 Lab#9A ImplementingaStack CS1B 1of4 Name1:...

Pulkit answered on Apr 11 2021
157 Votes
new/main.cpp
#include
#include "myheader.h"
using namespace std;
void Enqueue(int age
, string name, char gender)
{
node* temp = new node;
size++; //increse size by one
//insert element
if (rear == NULL)
{
front = rear = temp;
return;
}
rear->next = temp;
rear = temp;
}
void Dequeue()
{
if (front == NULL){
cout<<"Can't DEQUEUE from an empty list!"<return;
}
size--; //decrease size by one
node* temp = front;
cout<<"DEQUEUEING"<cout<<"Name: "<< front->name<cout<<"Gender: "<< front->gender<cout<<"Age: "<< front->age<front = front->next;
if (front == NULL)
rear = NULL;
delete (temp);
}
void IsEmpty()
{
if (front == NULL){
cout<<"Yes, the QUEUE is empty."< return;
}
cout<<"The QUEUE is NOT empty."<}
void Front()
{
if (front == NULL)
cout<<"Nobody in FRONT, the queue is empty!!"< else{
cout<<"The first person in the queue is:"< cout<<"Name:...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here