Create a simple queue class and a simple stack class. The queue and stack should be...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a simple queue class and a simple stack class. The queue and stack should be implemented as a linked list. Create three functions that utilize these data structures • Write a function that opens a text file and reads its contents into a stack of characters. The program should then pop the characters from the stack and save them in a second text file. The order of the characters saved in the second file should be the reverse of their order in the first file. • Write a function that opens a text file and reads its contents into a queue of characters. The program should then dequeue each character, convert it to uppercase, and store it in a second file. • Write a function that opens two text files and reads their contents into two separate queues. The program should then determine whether the files are identical by comparing the characters in the queues. When two nonidentical characters are encountered, the program should display a message indicating that the files are not the same. If both queues contain the same set of characters, a message should be displayed indicating that the files are identical. Create a driver program to test the functions. Create a simple queue class and a simple stack class. The queue and stack should be implemented as a linked list. Create three functions that utilize these data structures • Write a function that opens a text file and reads its contents into a stack of characters. The program should then pop the characters from the stack and save them in a second text file. The order of the characters saved in the second file should be the reverse of their order in the first file. • Write a function that opens a text file and reads its contents into a queue of characters. The program should then dequeue each character, convert it to uppercase, and store it in a second file. • Write a function that opens two text files and reads their contents into two separate queues. The program should then determine whether the files are identical by comparing the characters in the queues. When two nonidentical characters are encountered, the program should display a message indicating that the files are not the same. If both queues contain the same set of characters, a message should be displayed indicating that the files are identical. Create a driver program to test the functions.
Expert Answer:
Answer rating: 100% (QA)
Python class Node def initself data selfdata data selfnext None class Stack def initself selftop Non... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Given the relations U and S below, use ordered pair notation to express the relation So U. a SOU={Ex: (a, b), (b, c) b U b S C
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
1 Overview of the Application In this assignment, you will develop your social media platform (what we will call it is mysocialbook) with very simplified use case scenarios. To complete every...
-
[10 marks] Click the link below to see the code for a program. Your task is as in assignment 3: re-write the code of this program so that, to a user of the program, it works as before, but in your...
-
What was the basis for and the pattern of trade according to Adam Smith? How were gains from trade generated? What policies did Smith advocate in international trade? What did he think was the proper...
-
Health care facilities must conform to certain standards in submitting bills to Medicare/Medicaid for processing. The number of bills with errors and the number sampled are shown in Table 8-17....
-
Under what circumstances should a party be joined in an action?
-
A 24-kg uniform cylindrical roller, initially at rest, is acted upon by a 100-N force as shown. Knowing that the body rolls without slipping, determine (a) The velocity of its center G after it has...
-
Kaylee Dental provides high tech equipment for the dentistry trade, including specialized equipment for pediatric dentists. It has two support departments: engineering and materials; it has two...
-
A commercial real estate investment fund must report its quarterly investment performance to investors. A summary of its (1) beginning and end-of-quarter assets and equity and (2) cash inflows and...
-
A manufacturer of clothes washing machines decides to add matching clothes dryers to its product line. In this case, it is most likely important in the project analysis to consider a.cannibalization....
-
Use the add-on method of calculating interest to find the total interest and the monthly payment. Amount of Loan $4400 Length of Loan 2 years The total interest is $ (Round to the nearest cent as...
-
What issues had to be settled between senator sarbanes and representative oxley?
-
In 2010, the criminal code was amended to include income tax evasion as a designated offence; explain the implication from both the criminal and law enforcement perspective.
-
1 at W=b+ PW represents the complex potential for an electricia 4 = x+ determine the sunction &
-
Whitson Hog Heaven Inc. has the following capital budgeting opportunities this year. The following are the IRR and corresponding investments required by the projects listed below: Project IRR ...
-
Jill had made a capital loss of $1,000 in the 2017-2018 income year and had no capital transactions until now. Jill sells her holiday house on 1 January this year for $500,000. She bought the...
-
I frequently use NY Times and CNN and am aware of Fox News but I never use it. I visit these sites, NY Times and CNN, a few times a week whenever I have to research something or see something on...
-
Consider the following class declaration: class RQ1 { private: char * st; // points to C-style string public: RQ1() { st = new char [1]; strcpy(st,""); } RQ1(const char * s) {st = new char [strlen(s)...
-
Write a three-file program based on the following namespace: namespace SALES { const int QUARTERS = 4; struct Sales { double sales[QUARTERS]; double average; double max; double min; }; // copies the...
-
Here is declaration for the Cpmv class: class Cpmv { public: struct Info { std::string qcode; std::string zcode; }; private: Info *pi; public: Cpmv(); Cpmv(std::string q, std::string z); Cpmv(const...
-
Recording effects of transactions in T-accounts Record the transactions below for Amena Company by recording debit and credit amounts directly in the following T-accounts: Cash; Accounts Receivable;...
-
Identifying type and normal balances of accounts For each of the following (1) identify the type of account as an asset, liability, equity, revenue, or expense, (2) enter debit (Dr.) or credit (Cr.)...
-
Preparing a trial balance After recording the transactions of Exercise 3-2 in T-accounts and calculating the ending balance of each account, prepare a trial balance. Use May 31, 2008, as its report...
Study smarter with the SolutionInn App