Please complete it in C++
Part 1: Stack
The algorithm for checking is as follows:
At the end of the file, if the stack IS NOT EMPTY, output "The code is incorrect". Otherwise, output "The code is correct".
Use the provided files, testfile1.txt and testfile2.txt to test your program. The code file testfile1.txt is correct, while the code file testfile2.txt is incorrect.
Useful code:
#include <fstream> string readFile() { string tempString = ""; string filename;
cout << "Input file name: "; cin >> filename; ifstream inputFile(filename);
// Prompt user again if wrong filename received while (!inputFile.good()) { cout << "Wrong file name, input again please: "; cin >> filename; inputFile.open(filename); }
// Append all lines from the file into a long string while ((!inputFile.eof())) { string str; getline(inputFile, str); tempString += str; }
return tempString; } |
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "StackArr.h"
#include <string>
#include <iostream>
using namespace std;
StackArr::StackArr(int size) {
maxTop = size;
values = new char[size];
stackTop = -1;
}
StackArr::~StackArr() {
delete[] values;
}
bool StackArr::isEmpty() const {
return stackTop == -1;
}
bool StackArr::isFull() const {
return stackTop == maxTop;
}
void StackArr::push(const char& x) {
if (isFull())
cout << "Error! The stack is
full!" << endl;
else
values[++stackTop] = x;
}
char StackArr::pop() {
if (isEmpty()) {
cout << "Error! The stack is
empty!" << endl;
return -1;
}
else
return values[stackTop--];
}
char StackArr::top() const {
if (isEmpty()) {
cout << "Error! The stack is
empty!" << endl;
return -1;
}
else
return values[stackTop];
}
void StackArr::displayStack() const {
cout << "Top -->";
for (int i = stackTop; i >= 0; i--)
cout << "\t|\t" <<
values[i] << "\t|" << endl;
cout << "\t|---------------|" <<
endl;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "StackArr.h"
#include <string>
#include <iostream>
using namespace std;
StackArr::StackArr(int size)
maxTop = size;
values = new char[size];
stackTop = -1;
}
StackArr::~StackArr() {
delete[] values;
bool StackArr::isEmpty() const {
return stackTop == -1;
}
bool StackArr::isFull() const {
return stackTop == maxTop;
}
void StackArr::push(const char& x) {
if (isFull())
cout << "Error! The stack is
full!" << endl;
else
values[++stackTop] = x;
}
char StackArr::pop() {
if (isEmpty()) {
cout << "Error! The stack is
empty!" << endl;
return -1;
}
else
return values[stackTop--];
}
char StackArr::top() const {
if (isEmpty()) {
cout << "Error! The stack is
empty!" << endl;
return -1;
}
else
return values[stackTop];
}
void StackArr::displayStack() const {
cout << "Top -->";
for (int i = stackTop; i >= 0; i--)
cout << "\t|\t" <<
values[i] << "\t|" << endl;
cout << "\t|---------------|" <<
endl;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//StackArr.h
#ifndef STACKARR_H
#define STACKARR_H
class StackArr {
private:
int maxTop;
int stackTop;
char *values;
public:
StackArr(int);
~StackArr();
bool isEmpty() const;
bool isFull() const;
char top() const;
void push(const char& x);
char pop();
void displayStack() const;
};
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////StackArr.cpp
#include "StackArr.h"
#include <string>
#include <iostream>
using namespace std;
StackArr::StackArr(int size) {
maxTop = size;
values = new char[size];
stackTop = -1;
}
StackArr::~StackArr() {
delete[] values;
}
bool StackArr::isEmpty() const {
return stackTop == -1;
}
bool StackArr::isFull() const {
return stackTop == maxTop;
}
void StackArr::push(const char& x) {
if (isFull())
cout << "Error! The stack is
full!" << endl;
else
values[++stackTop] = x;
}
char StackArr::pop() {
if (isEmpty()) {
cout << "Error! The stack is
empty!" << endl;
return -1;
}
else
return values[stackTop--];
}
char StackArr::top() const {
if (isEmpty()) {
cout << "Error! The stack is
empty!" << endl;
return -1;
}
else
return values[stackTop];
}
void StackArr::displayStack() const {
cout << "Top -->";
for (int i = stackTop; i >= 0; i--)
cout << "\t|\t" <<
values[i] << "\t|" << endl;
cout << "\t|---------------|" << endl
<< endl;
}
In: Computer Science
In what manner are firms investing or using “offshore cash” being brought back into the United States?
In: Operations Management
In the divisional structure, if there were a separate sales organization responsible for providing revenue for each of the divisions, what are advantages and disadvantages of such a structure?
What if the structure was that way from the outset and an acquisition was made of a company with its own sales force. how hard would it be to integrate the acquired company into the new structure?
In: Operations Management
Match the term or phrase with the correct Phylum (Division)
1.possess chlorophyll b
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
2. constructed of little "pill-boxes"
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
3.body structure has distinct organs
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
4. possess phycoerythrin
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
5.possess chlorophyll a
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
6.have cell walls
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
7. Siphonocladous body form
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
8.produce up to 50% of the atmospheric oxygen
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
9. possess floridean starch as a storage product
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
10.possess conceptacles at the receptacle tips
A. phaeophyta b.chrysophyta (Bacillariophyta) c.chlorophyta D.All phyla E.Rhodophyta
In: Biology
Case Study
Owen Mills Limited
We have all that you want!
Owen Mills Limited began its operations on Trumpet Land, a beautiful island in the Caribbean with a very diverse population in terms of age, gender, ethnicity, religion, disability, sexual orientation, education, and origin. In 1970, at the age of twenty-eight (28), Owen Mills a progressive thinking young man decided to start his own business. His father had worked as a Manager at a large department store in the city of Trumpet Land for as long as Owen can remember, and his father would share his daily experiences. The idea of operating his own business was always at the forefront of Owen’s mind. After gaining four (4) Advanced Level subjects (Mathematics, Geography, English Literature and Spanish), Owen got a job at a large Credit Union where he moved up the ranks from a Customer Service Clerk to Supervisory level within four (4) years and then onto being a Credit Officer.
During his time at the Credit Union, Owen attended a number of short management courses. This built his confidence that someday soon he will achieve his dream of being a big business man. At age twenty-eight (28) Owen thought that he had saved sufficient money along with his wife who worked at another Credit Union, so that they could purchase a small one-story building in the heart of the city. The building was at the corner of French Street and John Street, the main street in the city. The building was refurbished and painted in bright red, and blue to suit the liking of Mr. Mills. He thought to himself “No one could miss this building” and he also thought of a tag line. Business started in February 1970. From the inception of the business to date, the tagline emblazoned at the front of the store “We have all that you want!’ has remained.
The Early Years
Owen Mills Limited operated as a sole proprietorship for many years selling almost every item that a household could want, staying true to his tagline. The business began with five (5) employees: his wife serving as the cashier, two store clerks, one driver and a cleaner. The store was well sectioned with a variety of items as shown in Table #1 below.
Table #1 – Variety of Items sold by Owen Mills Limited
Cosmetics and related products for men and women. |
School items – copy books, pencils, pens rulers, etc. |
Basic food/grocery items – rice, flour, sugar, peas, salt, seasonings and other condiments |
Personal hygiene products |
Plumbing and electrical material |
A variety of snacks and soft drinks |
Perfumes/fragrances |
Small appliances |
Kitchen ware and Glassware |
Clothing and footwear for babies, and boys and girls |
Household items – batteries, glue, tacks, etc. |
A variety of gift items |
Ladies and gents’ underwear and other everyday garments |
Household cleaning products |
Gardening tools/implements and hardware items |
Gym shoes and slippers for ladies and gents |
Sewing items |
A variety of handy man tools |
Orders would be placed with wholesalers who would deliver the products on scheduled days. Mr. Mills was very organized. During the first two (2) years of operating in the city of Trumpet Land, Mr. Mills observed that his customers comprised of citizens from all over the island. He got an idea, “I could go to the outer area of the city with my products.” He started in October 1971 to pack his Toyota panel van and leave with his driver on Saturdays and Sundays to the areas bordering the city. Mr. Mills was successful with this venture and discovered that there were retirees and housewives who were at home during the week, and he began to go into those area at least two (2) days per week in addition to Saturdays and Sundays.
Clearly, Mr. Mills was an astute businessman who was always thinking of the next move to grow the business. He and his wife joined the Chamber of Commerce, read widely about what was happening locally, regionally and internationally, and made every effort to attend conferences and seminars which they thought would be beneficial. He was always thinking about growth and expansion. Owen Mills Limited became a known business even to those persons who had never patronized the store. In the midst of it all, Mr. Mills understood his corporate social responsibility and as such was respected highly by other businessmen and members of the community and country. A proud moment for Mr. Mills, his family and employees occurred when he was awarded Business Man of the Year Award in 1999.
On a Growth Path
The years flew by very quickly and by 1995, Mr. Mills had added two (2) more floors to the original building that he bought. He now had four (4) grown children (two (2) boys and two (2) girls) all in their twenties and who all showed an interest in the business. Similar to their father, they had done very well at the secondary school level and had aspirations of gaining a tertiary level education as well as being a part of the business. They pondered their options of going to school full-time or enrolling in an online programme, so that they could better manage their time and fulfill their career objectives. The oldest son began to pursue the Association of Chartered Certified Accountants (ACCA) Programme. He thought that he can become the Accountant for Owen Mills Limited or open an accounting firm in the next few years.
By the year 2000, Mr. Owen Mills had spread his wings to the eastern, southern and western part of Trumpet Land. He was able to purchase within a five-year period, three (3) large two-story buildings in each of the areas. The buildings were painted in the same colors as the first one in the city in the north and carried the well-known tagline - We have all that you want! The business incurred a manageable mortgage loan, but that will be repaid in less than ten (10) years.
Mr. Mills began to think about succession for his business and the future of his children who had been supporting him throughout the years. He held a family meeting and it was decided that with the imminent opening of three (3) other Branches, that each child would manage a branch and he will now be considered as the Chairman.
In the midst of the initiatives being undertaken, Mr. Mills was very cognizant that the world of business was wrought with dynamism and uncertainty and he and his family needed to understand about strategic moves that could be undertaken. He had been reading and trying to keep up to date with what was happening in the world of business. He and his family did not have a full grasp of the theoretical underpinnings to maneuver quickly out of any new challenges, and he understood very well that challenges can surface with expansion. By 2018, the total staff had grown to eighty (80) persons which included cashiers, information technology personnel, supervisors, customer service staff, cleaners, drivers and his four (4) children as managers,
Looking to the Future
Undoubtedly, Owen Mills Limited has been a successful enterprise. However, Mr. Mills and his eldest son, who had gained his ACCA qualification began to look at the financials very closely. They recognized that while the company had repaid the mortgage loans, and there was still an influx of customers at all branches, the profits had been reducing in the three (3) years prior to 2020, though minimally.
Mr. Mills and his family had their usual monthly meeting in December 2019. One of the daughters took some points in relation to the present status of the Company. It related to a SWOT Analysis. Whist the SWOT Analysis was not fully articulated in terms of what the strengths can and have brought to the Company; how the weaknesses are impacting the Company; the possible outcomes from taking advantage of available opportunities; and the possible impact of threats, her brief notes are highlighted below:
Strengths:
Weaknesses
Opportunities
Threats
At the start of 2020, Mr. Mills and his family began to follow the news with respect to the deadly COVID-19 virus. “This is a time for quick action” pondered Mr. Mills. The business has been successful, but Mr. Mills and family has recognized that things are changing in the environment and could have negatives on the business. At the January 2020 monthly meeting, it was decided that the company should seek the services of a reputable consultant who can advise and assist the company with getting a clear understanding of what strategic management and planning entails. Other matters discussed which the family agreed to pursue, include embarking on a training initiative which would include staff at all levels as well as to create an awareness of the environmental factors that can affect the company. One member in the meeting raised the issue of how they can determine with accuracy the financial situation at the company. She is aware that ratios could be used, but that’s as much as she knows.
Mr. Mills stretched his imagination, “We had better start thinking about starting a branch in some foreign country, or start to manufacture something that people will need.” Then he pondered to himself, “I do not have all the knowledge about the intricacies of manufacturing and so-called strategies to continue to be a winner”
The meeting ended with Mr. Mills thinking aloud that they should all read up about what it means to be innovative. He indicated that at the next meeting, they will all come with their ideas of a plan that is different to what they are doing now and which can contribute to continued success. He was not sure what type of plan that would be. He has been following keenly the possible impact and negative fallout that the company could experience because of the COVID-19 virus. However, the astute businessman that Mr. Mills is, he purchased some cotton material, took some elastic and thread from the store, and hired two (2) seamstresses to make protective masks. The masks have been a fast seller and is bringing a profit to the store. Once more, Owen Mills Limited is living up to its tagline - We have all that you want!
Question 3(c):
Based on the existing situation at Owen Mills Limited, and as the Consultant hired by the Company, suggest three (3) strategies that the Company could undertake to maintain a competitive advantage. Provide justification for your selected strategies.
In: Operations Management
Use the following project information:
Activity | Optimistic Time Estimate(weeks) |
Most Likely
Time Estimates (weeks) |
Pessimistic
Time Estimates (weeks) |
Immediate Predecessor(s) |
||||
A | 2 | 7 | 11 | none | ||||
B | 2 | 5 | 9 | A | ||||
C | 4 | 6 | 12 | A | ||||
D | 5 | 6 | 10 | B | ||||
E | 6 | 10 | 17 | C | ||||
F | 3 | 4 | 6 | D,E | ||||
G | 3 | 6 | 10 | D,E | ||||
H | 5 | 7 | 10 | F | ||||
I | 5 | 8 | 11 | G | ||||
J | 3 | 3 | 3 | H,I | ||||
(a) Calculate the expected completion time for this project.
(Round your answer to 2 decimal places, the tolerance is +/-0.01.)
Project completion time = weeks.
(b) Identify the activities included on the
critical path of this project.
(If there are several critical paths enter the first
one from the alphabetical order.)
Critical activities:
ACEFHJ
ABDFHJ
ACEGIJ
ABDGIJ
.
In: Operations Management
The Federal Reserve decides to sell $50 million in government debt to households paying with checkable deposits. The current reserve requirement is 5%.
a. The Fed decision will lead to [more fewer the same ] reserves in the banking system and [ more less the same ] money in circulation.
b. The money supply will [increase decrease remain the same] by a maximum of [$ million.]
In: Economics
When the Supreme Court interprets the Constitution, it relies on “governmental justification.” There is a tiered standard of review framework for equal protection jurisprudence. Describe three standards involved in this review.
In: Psychology
Discuss 3 risks and 3 benefits of cloud-based computing especially as it relates to the expenditure cycle of an organization.
In: Accounting
You have recently accepted a position as Human Resource Director for Jupiter Industries, a multi-national organization operating across 5 business segments, specifically, industrial valves and controls, plastics, fire suppression equipment, electronic components, and specialized medical products. Jupiter Industries has established worldwide headquarters in Bremen, Germany, and has groups located in the Americas, Europe, Asia and Pacific Rim countries. The MENA group is the most recently formed division within the Jupiter organization, and is composed of various concentric businesses that fit into one of the five organizational business segments, all of which have been acquired over the past two years in both the Middle East region (Saudi Arabia, UAE, Oman, Bahrain, and Jordan) as well as North Africa (Egypt, Morocco, Tunisia, and Algeria). You will be working at the MENA headquarters located in Manama, Bahrain and will be responsible for all divisions located in the MENA (Middle East, North Africa) region. You will report directly to the VP of Operations in Manama, with dotted-line reporting responsibility to Chief Human Resources Officer (CHRO) in Bremen.
Specifically, you are being tasked with establishing Human Resource policy and practice in regard to strategic collaboration with divisional heads, utilizing HRIS systems in addressing areas such as recruitment and retention, training and development, performance management programs, compensation management, employee benefit programs and employee relations, including motivational programs, incentive programs, and disciplinary procedures. You will be working on policies and procedures that can be utilized throughout the region, to bring some semblance of order and uniformity in dealing with strategic HR employee programs.
After a thoughtful review of current HR programs for the region, you will prepare a report for the VP of Operations and CHRO and distribute to all division heads, formulating your HR strategic goals across all HR areas of responsibility, highlighting recommendations for improving the overall impact of these programs on talent management initiatives including attraction and retention of top talent and the methodologies used to do so.
What role do line managers play in this rolprocess? Why are coaching skills a necessary asset for line managers? How does coaching influence employee motivation and job performance?
One of your first assignments will be to address high turnover among new hires employed for less than 120 days. This is a constant source of frustration for both HR and hiring managers. How could an onboarding program help reverse this trend? Describe your plan and explain your anticipated results and outcomes
In: Operations Management
Does the creative strategy (e.g., the Big Idea) contribute to campaign legs? If so, how? How about the media strategy? Which one is more important, do you think?
In: Operations Management
Remove inline style to an external file
<!DOCTYPE html>
<html>
<head>
<title>PROBLEM</title>
</head>
<body>
<form>
<table style="color:white;background-color:blue;border:solid
black 7px;border-radius:25px;">
<tr><th colspan="2"
style="color:white;background-color:black;border:solid black
2px;outline:solid black 2px;">SQUARE
PROBLEM</th></tr>
<tr> <td><label>Enter
side:</label></td><td> <input type="text"
style="background-color:#DEDEE6;border:4px solid red;"/>
</td> </tr>
<tr>
<td><label>Area:</label></td><td>
<input type="text" readonly
style="background-color:#DEDEE6;border:4px solid yellow;"/>
</td> </tr>
<tr>
<td><label>Perimeter:</label></td>
<td> <input type="text" readonly
style="background-color:#DEDEE6;border:4px solid yellow;"/>
</td> </tr>
<tr>
<td colspan="2" >
<center>
<input type="button" value="Area"
style="color:white;background-color:black;border:1px solid
red;"/>
<input type="button" value="Perimeter"
style="color:white;background-color:black;border:1px solid
white;"/>
<input type="button" value="Both"
style="color:white;background-color:black;border:1px solid
red;"/>
<input type="button" value="Clear"
style="color:white;background-color:black;border:1px solid
white;"/>
</center>
</td>
</tr>
</table>
</form>
</body>
</html>
In: Computer Science
How will you implement formative assessment in your classroom to support the Common Core State Standards and the ongoing, formative assessment of ELL students?
In: Psychology
Question (a): Prior to liquidating their partnership, Perkins and Brooks had capital accounts of $46,000 and $74,000, respectively. Prior to liquidation, the partnership had no cash assets other than what was realized from the sale of assets. These partnership assets were sold for $144,000. The partnership had $5,000 of liabilities. Perkins and Brooks share income and losses equally. Determine the amount received by Brooks as a final distribution from liquidation of the partnership.
Question (b): Steve Conyers and Chelsy Poodle formed a partnership, dividing income as follows: Annual salary allowance to Poodle of $170,500. Interest of 6% on each partner's capital balance on January 1. Any remaining net income divided to Conyers and Poodle, 1:2. Conyers and Poodle had $77,600 and $75,000, respectively, in their January 1 capital balances. Net income for the year was $310,000. How much is distributed to Conyers and Poodle?
Question (c): On January 1, 2016, Valuation Allowance for Available-for-Sale Investments had a zero balance. On December 31, 2016, the cost of the available-for-sale securities was $84,200, and the fair value was $77,810.
In: Accounting