Starting from:
$35

$29

Programming Assignment 4 Stacks – Queues Solution

For this assignment you will implement stacks and queues ADT.A stack or a queue can be used to recognize a certain types of patterns.




Consider the pattern STRING1#STRING2 where neither STRING1 and STRING2 contains“#”.




Use stack ADT to determine whether or not the two strings are the same. STRING1 and STRING2 are the same if they have the same number of elements and the elements at the corresponding positions are thesame.




Use queue ADT to determine whether or not STRING2 is reversed of STRING1.




Theprogram displays amenuonthescreenallowingtheuser to entertheelements of stack or queue. The program terminates when theuserenters 9.







Note :




Size of stack and queue is determined by the number of the elements entered.
You are not allowedtouse stack / queue libraries. You must implement all stack / queue functions and operations . Use onlyone
.cpp to define and implement templates and the drivingprogram.

You are not allowed to use string manipulation operations.
Validations:




The program accepts only integer data type when selecting from the menu (1 , 2 , or 9). Everything else should be rejected with an invalid option message.




Style Guidelines:




At the beginning of your program ( andbeforethe #include statement ), include the following :




Header comments(file documentation block) should be at the top of each file and should contain: Author / s, Due Date, Assignment Number, Course number and section, Instructor, and a brief description of the purpose of the code in the file. For example :

// Roster Number /s: xxxxxxxxx

//

// Author / s : (Your namehere!!)

// Due Date:

// Programming Assignment Number4

//

// Spring ­‐CS3358 -­‐ Your SectionNumber

//

// Instructor: HusainGholoom.

//

// <Brief description of the purpose of theprogram







Variable names :



Must bemeaningful.
The initial letter should be lowercase, following words should be capitalized, noother caps or punctuation(i.e. weightInPounds ).
Each variable must be declared on a separate line with a descriptivecomment.






Named constants :




Use for most numericliterals.
All capitals with underscores(i.e. TX_STATE_SALES_TAX )
Should occur at top of function, or global (only ifnecessary)



Line lengthof source code should be no longer than 80 characters (no wrapping of lines).




Indentation :




Use 2-4 spaces (but be consistent throughout yourprogram).
Indent blocks, within blocks,etc.
Use blank lines to separatesections.






Comments for variables :




All variable definitions should be commented as follows:




int gender; // integer value for thegender,

// 1 = Male , 2 = Female ,

Sample Run :




***WelcometoMystack/QueueProgram*** Thefunctionofthisprogramisto:

Usestacktodeterminewhetherornottwo stringsarethesame.



Use queue to determine whether ornotSTRING2 is the reversed ofSTRING1.



Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 1




EnterStackValues: 5+(12+7)#5+(12+7)Stringsareidentical




Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 1




EnterStackValues: 5+(12+7]#5+(12+7)Stringsare notidentical




Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 1




EnterStackValues: 5+[12+7)#5+[12+7Stringsare notidentical










Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 2




EnterQueueValues: 1234#4321STRING2reversedofSTRING1.




Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 2




EnterQueueValues: 1{[(#([{1STRING2reversedofSTRING1.







Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 2




EnterQueueValues: 1{[(#([{2STRING2isnotreversedofSTRING1.




Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 2




EnterQueueValues: 1{[(#([{ STRING2isnotreversedofSTRING1.










Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. 3




InvalidOption







Select from the following menu

EnterStackValues.
Enter QueueValues.
9. Terminatetheprogram. X




InvalidOption







Select from the following menu

EnterStackValue.
Enter QueueValues.
9. Terminatetheprogram. 9










***Endoftheprogram. ***

***WrittenbyHusainGholoom***

***March28–2018 ***

Rules :
This program must be done as a group. Individual work willnot be accepted and a grade of zero will beassigned.
Your programmust compileand run. The program will be tested using the latest version of Codeblocks forwindows.
You renot allowedto use stack and queue libraries . You Must implement all the functions of stacks and queues. You are also not allowed to use static arrays , vectors or string manipulation operations .
Your program must be properlydocumented according the style above .See the website for the sample programming styleprogram.
You must userepetitions , control structures , andswitchstatements.
Must properly format the output by use the appropriate library. See the outputbelow
. Also ,Replace my first / last name with your own first / last name.

You must name your program as:



3358_0_LastName_FirstName_PG5.cpp ( Section 260)
3358_1_LastName_FirstName_PG5.cpp ( Section 261)
3358_2_LastName_FirstName_PG5.cpp ( Section 262)



Where LastName is your Last Name and FirstName is your First Name. For example , the file name should look something like : 3358_1_Gholoom_Husain_PG5.cpp (not

.cbp)




Every one must upload the electronic version of the program no later than the starting of class time on the due date.No late assignments will be accepted.DO NOTsend your assignment solution via email.Group members must upload identical copy of theassignment.



Use TRACS To upload electronic version of your program







You mustalsoturn in hard copy of your source code no later than the starting of class time on the due date . should the hard copy consist of more than one page , then , the hard copy must bestapled. if you are unable to turn in a printout during class, you can take the program to the computer science department and hand it to the front desk personal (Comal 211 ) before the deadline. Make sure that the front office stamps the program. Make sure that include the date and time. Finally ,make sure that they place the program in my mailbox.Only one copy per group.



DO NOTslide your program under my office door – It willNOTbe accepted







The following points will bedeductedif:




Compilation errors , incorrect file format such asuploading.cbp insteadof
.cpp , missing electronic copy , missing the hardcopy , different copies of the assignment per group ,using .hand.cpp files , using vectors , usingstack

/ queue libraries,string manipulations, using static arrays or global arrays , using vectors or global vectors , not using class , using recursion … etc(

- 10 points )




LogicalErrors (at least - 1.25 points)



Other(atleast -1.50points) ifanyof the following takes a place:



Unable to read the source code due to unclearprinting
Incorrect Outputformat.
Incorrect program filename.
Hard copy is notstapled.
Incorrect Stylesuch as but not limited toMissing Header comments , signature line , comments or programdocumentations
, missing roster number , section number , , not using switch … etc

More products