Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

This answer was rated:

This week you'll be making the following refinements to the…

This week you'll be making...
This week you'll be making the following refinements to the class that you wrote in the last assignment. All the requirements from that class are still in force. For example, all MyStrings must always be stored in a dynamic array that is exactly the correct size to store the string. Your score on this assignment will take into consideration your work on both the previous assignment and this assignment.1. Extraction OperatorJust like the >> operator that reads C-strings, your >> operator should skip any leading spaces and then read characters into the string up to the first whitespace character.For reasons of convenience, we will impose a limit of 127 on the number of characters this function will read. This is so you can temporarily read into a non-dynamic array and then copy what you need into your data member, which will be a dynamic array. Note that this does not mean that all MyStrings will always have a maximum of 127 characters. For example, you might get a MyString with more than 127 characters by using the MyString constructor or by concatenating two MyStrings.Hint: Don't try to read character by character in a loop. Use the extraction operator to do the reading of the input into a non-dynamic array, then use strcpy() to copy it into your data member. Make sure to allocate the correct amount of memory.Hint: if you use the extraction operator as suggested above, you will not have to skip leading whitespace, because the extraction operator does that for you.2. A read() functionThe read() function will allow the client programmer to specify the delimiting character (the one to stop at instead of the first whitespace character). It should work just like the getline() function works for c-strings; that is, it should place everything up to but not including the delimiting character into the calling object, and it should also consume (and discard) the delimiting character. This will be a void function that will take two arguments, a stream and the delimiting character. It should not skip leading spaces. The limit of 127 characters imposed on the >> function above also applies to this function.Hint: Don't try to read character by character in a loop. Use the in.getline() function to do the reading of the input into a non-dynamic array, then use strcpy() to copy it into your data member.3. Concatenation OperatorOverload the + operator to do MyString concatenation. The operator must be able to handle either MyString objects or C-strings on either side of the operator. Be careful with the memory management here. You'll have to allocate enough memory to hold the new MyString. I suggest using strcpy() to get the left operand into the result MyString, and then strcat() to append the right operand. Both strcpy() and strcat() should be used as if they are void, even though they do have return values.4. Combined Concatenation/Assignment OperatorOverload the shorthand += to combine concatenation and assignment. Only MyStrings can be on the left-hand side of a += operation, but either MyStrings or C-strings may appear on the right side. If you pay close attention to the += operator from the feetInches class, these may be the easiest points of the semester.5. Add DocumentationHints about reading input files:I suggest that you copy the text from the input file webpage(s) and paste it into a file that you have created using your IDE. The files you create when you type in your IDE are always text files (even if they don't end with .txt). If you're using Windows, you could also use Notepad, but there's no reason to open another application when you are already working in your IDE. I strongly suggest that you don't use TextEdit (Mac) or Word, because these do not store files as text files by default.Where to save your input file so that your IDE can find it:In Visual C++, right click on the name of the project in the solution explorer. It appears in bold there. Unless you chose a different name for the project, it will be ConsoleApplication1. From the drop-down menu, choose "show folder in windows explorer". The folder that opens up will be the correct place to save your file.For Windows users, before you start this assignment, I suggest that you make sure that Windows is showing you the complete file name of your files, including the extensions. Windows hides this from you by default. In Windows 7 and 8 the procedure is as follows:Choose "control panel" from the start menu
Choose "Folder Options" from the list of control panel items. In Windows 8 you may have to type "Folder Options" into the control panel search bar.
Choose the "view" tab from the Folder Options window
Find the checkbox that says "Hide extensions for known file types".
Uncheck that checkbox.
Show More
Show Less
Ask Your Own Homework Question
Customer reply replied 8 months ago
Here is the client program
/*
* -------------------
* These functions are designed to help you test your MyString objects,
* as well as show the client usage of the class.
*
* The BasicTest function builds an array of strings using various
* constructor options and prints them out. It also uses the String
* stream operations to read some strings from a data file.
*
* The RelationTest function checks out the basic relational operations
* (==, !=, <, etc) on Strings and char *s.
*
* The ConcatTest functions checks the overloaded + and += operators that
* do string concatenation.
*
* The CopyTest tries out the copy constructor and assignment operators
* to make sure they do a true deep copy.
*
* Although not exhaustive, these tests will help you to exercise the basic
* functionality of the class and show you how a client might use it.
*
* While you are developing your MyString class, you might find it
* easier to comment out functions you are ready for, so that you don't
* get lots of compile/link complaints.
*/
#include "mystring.h"
#include <fstream>
#include <cctype> // for toupper()
#include <string>
#include <cassert>
#include <iostream>
using namespace std;
using namespace cs_mystring;void BasicTest();
void RelationTest();
void ConcatTest();
void CopyTest();
MyString AppendTest(const MyString& ref, MyString val);
string boolString(bool convertMe);int main()
{
BasicTest();
RelationTest();
ConcatTest();
CopyTest();
}string boolString(bool convertMe) {
if (convertMe) {
return "true";
} else {
return "false";
}
}void BasicTest()
{
MyString s;
int stringLength;
cout << "----- Testing basic String creation & printing" << endl;
const MyString strs[] =
{MyString("Wow"), MyString("C++ is neat!"),
MyString(""), MyString("a-z")};
for (int i = 0; i < 4; i++){
cout << "string [" << i <<"] = " << strs[i] << endl;
}cout << endl << "----- Now reading MyStrings from file" << endl;
cout << endl << "----- first, word by word" << endl;
ifstream in("mystring.txt");
assert(in);
while (in.peek() == '#'){
in.ignore(128, '\n');
}
in >> s;
while (in) {
cout << "Read string = " << s << endl;
in >> s;
}
in.close();
cout << endl << "----- now, line by line" << endl;
ifstream in2("mystring.txt");
assert(in2);
while (in2.peek() == '#'){
in2.ignore(128, '\n');
}
s.read(in2, '\n');
while (in2) {
cout << "Read string = " << s << endl;
s.read(in2, '\n');
}cout << endl << "----- Testing access to characters (using const)" << endl;
const MyString s1("abcdefghijklmnopqsrtuvwxyz");
cout << "Whole string is " << s1 << endl;
cout << "now char by char: ";
stringLength = s1.length();
for (int i = 0; i < stringLength; i++){
cout << s1[i];
}cout << endl << "----- Testing access to characters (using non-const)" << endl;
MyString s2("abcdefghijklmnopqsrtuvwxyz");
cout << "Start with " << s2;
stringLength = s2.length();
for (int i = 0; i < stringLength; i++){
s2[i] = toupper(s2[i]);
}
cout << " and convert to " << s2 << endl;
}void RelationTest()
{
cout << "\n----- Testing relational operators between MyStrings\n";const MyString strs[] =
{MyString("app"), MyString("apple"), MyString(""),
MyString("Banana"), MyString("Banana")};for (int i = 0; i < 4; i++) {
cout << "Comparing " << strs[i] << " to " << strs[i+1] << endl;
cout << "\tIs left < right? " << boolString(strs[i] < strs[i+1]) << endl;
cout << "\tIs left <= right? " << boolString(strs[i] <= strs[i+1]) << endl;
cout << "\tIs left > right? " << boolString(strs[i] > strs[i+1]) << endl;
cout << "\tIs left >= right? " << boolString(strs[i] >= strs[i+1]) << endl;
cout << "\tDoes left == right? " << boolString(strs[i] == strs[i+1]) << endl;
cout << "\tDoes left != right ? " << boolString(strs[i] != strs[i+1]) << endl;
}
cout << "\n----- Testing relations between MyStrings and char *\n";
MyString s("he");
const char *t = "hello";
cout << "Comparing " << s << " to " << t << endl;
cout << "\tIs left < right? " << boolString(s < t) << endl;
cout << "\tIs left <= right? " << boolString(s <= t) << endl;
cout << "\tIs left > right? " << boolString(s > t) << endl;
cout << "\tIs left >= right? " << boolString(s >= t) << endl;
cout << "\tDoes left == right? " << boolString(s == t) << endl;
cout << "\tDoes left != right ? " << boolString(s != t) << endl;
MyString u("wackity");
const char *v = "why";
cout << "Comparing " << v << " to " << u << endl;
cout << "\tIs left < right? " << boolString(v < u) << endl;
cout << "\tIs left <= right? " << boolStrin
Customer reply replied 8 months ago
Here is data file# This file has some strings that are used in the string test to check
# reading strings from files. The default overloaded >> of your string
# class should skip over any leading spaces and read characters into
# the string object, stopping at the first whitespace character (this is
# similar to the behavior of >> on char *). The read method of the
# string class is a little fancier. It allows client to restrict
# how many characters at max to read and what character to use as
# delimiter, so you can stop at newline instead of space, for example.
# Reading consumes the delimiting character, so the next read starts
# after that.
#
The first time we will
read individual words, next
we read whole linesAnd correct output----- Testing basic String creation & printing
string [0] = Wow
string [1] = C++ is neat!
string [2] =
string [3] = a-z----- Now reading MyStrings from file----- first, word by word
Read string = The
Read string = first
Read string = time
Read string = we
Read string = will
Read string = read
Read string = individual
Read string = words,
Read string = next
Read string = we
Read string = read
Read string = whole
Read string = lines----- now, line by line
Read string = The first time we will
Read string = read individual words, next
Read string = we read whole lines----- Testing access to characters (using const)
Whole string is abcdefghijklmnopqsrtuvwxyz
now char by char: abcdefghijklmnopqsrtuvwxyz
----- Testing access to characters (using non-const)
Start with abcdefghijklmnopqsrtuvwxyz and convert to ABCDEFGHIJKLMNOPQSRTUVWXYZ----- Testing relational operators between MyStrings
Comparing app to apple
Is left < right? true
Is left <= right? true
Is left > right? false
Is left >= right? false
Does left == right? false
Does left != right ? true
Comparing apple to
Is left < right? false
Is left <= right? false
Is left > right? true
Is left >= right? true
Does left == right? false
Does left != right ? true
Comparing to Banana
Is left < right? true
Is left <= right? true
Is left > right? false
Is left >= right? false
Does left == right? false
Does left != right ? true
Comparing Banana to Banana
Is left < right? false
Is left <= right? true
Is left > right? false
Is left >= right? true
Does left == right? true
Does left != right ? false----- Testing relations between MyStrings and char *
Comparing he to hello
Is left < right? true
Is left <= right? true
Is left > right? false
Is left >= right? false
Does left == right? false
Does left != right ? true
Comparing why to wackity
Is left < right? false
Is left <= right? false
Is left > right? true
Is left >= right? true
Does left == right? false
Does left != right ? true----- Testing concatentation on MyStrings
outrageous + milk = outrageousmilk
milk + = milk
+ cow = cow
cow + bell = cowbell----- Testing concatentation between MyString and char *
abcde + XYZ = abcdeXYZ
XYZ + abcde = XYZabcde----- Testing shorthand concat/assign on MyStrings
who += what = whowhatandwhowhat
what += WHEN = whatWHENandwhatWHEN
WHEN += Where = WHENWhereandWHENWhere
Where += why = WherewhyandWherewhy----- Testing shorthand concat/assign using char *
I love += programming = I love programming----- Testing copy constructor and operator= on MyStrings
original is cake, copy is fake
original is cake, copy is fake
after self assignment, copy is Copy Cat
Testing pass & return MyStrings by value and ref
after calling Append, sum is BinkyBoo
val is winky
after assign, val is BinkyBoo
Customer reply replied 8 months ago
This is the original program
http://wikisend.com/download/722302/MyString.zip
Answered in 2 hours by:
11/21/2017
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,500
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified

Hi,

Welcome back.

What is the deadline?

Ask Your Own Homework Question
Customer reply replied 8 months ago
Tomorrow 12:00 pm

okay. Will have it ready

Ask Your Own Homework Question

Let me know once accepted

LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,500
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified
LogicPro and 87 other Homework Specialists are ready to help you
Ask your own question now

Please upload the complete client program and output as text seems to be truncated. Also wikisend link is not working.

Ask Your Own Homework Question
Customer reply replied 7 months ago
Sorry for replying so late, can you finish it by 11:59 pm
Customer reply replied 7 months ago
hello
Customer reply replied 7 months ago
are you there

I am here.

Still the client program is not complete.

Please provide me complete client code.

Ask Your Own Homework Question
Customer reply replied 7 months ago
here is all the thing

This does not have complete code.

The code is truncated.

You can check it on page 6 after line #1.

Ask Your Own Homework Question
Customer reply replied 7 months ago
how about this one
Customer reply replied 7 months ago
this is data file

How many hours are left for deadline?

Ask Your Own Homework Question
Customer reply replied 7 months ago
actually one hour
Customer reply replied 7 months ago
it is hard to finish, right?

I will try my best to provide it in 1-2 hours.

Ask Your Own Homework Question
Customer reply replied 7 months ago
Thank you so much

Welcome

Ask Your Own Homework Question

Posted the answer link for MyString_Part2.zip

Let me know once you get it

Ask Your Own Homework Question

Just posted the answer Link
Let me know once you get it

Please consider adding bonus by using the "Write a review or give a bonus" button on your question pages.
http://ww2.justanswer.com/help/what-if-expert-does-really-fantastic-job-hl

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers. It will ensure that question is for me.
Please bookmark my profile page:
http://www.justanswer.com/homework/expert-logicpro/
so you can come back and ask me a question anytime.
Thank you for using this site!
LogicPro

Ask Your Own Homework Question
Customer reply replied 7 months ago
I got it
This answer is protected
Would you like to ask this question?
If you've already paid for this answer, simply Login.
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a tutorLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask LogicPro Your Own Question
LogicPro
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,500
13,500 Satisfied Customers
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML

LogicPro is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

DianeDallas, TX

< Previous | Next >

Meet the Experts:

LogicPro

LogicPro

Engineer

13,500 satisfied customers

Expert in Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,556 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

Chris M.

M.S.W. Social Work

2,698 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

F. Naz

Chartered Accountant

2,190 satisfied customers

Experience with chartered accountancy

Bizhelp

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

Seanna

Seanna

Tutor

1,781 satisfied customers

3,000+ satisfied customers, all topics, A+ work

< Previous | Next >

Related Homework Questions
For LogicPro Only: Create an array based lookup table for
For LogicPro Only: Create an array based lookup table for the following 48 C++ reserved words: asm class double friend new return switch union auto const else goto operator short template unsigned bre… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
For LogicPro only: Write a program that can be used to store
For LogicPro only: Write a program that can be used to store a phrase. Your program must have a StaticQueue class that contains an array of c-strings (2D array of chars, with each row being a c-string… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
See also client program and correct output. Write a string
See also client program and correct output.Write a string class. To avoid conflicts with other similarly named classes, we will call our version MyString. This object is designed to make working with … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
I need help writing this progra, Write a C++ program that
I need help writing this progra, Write a C++ program that processes records of items purchased. Assume the items are being purchased by one person.Create a class definition for item records with the f… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
are you there? i have an assignment due tonight it is
Hello are you there? i have an assignment due tonight it is about C++. and i have two supporting files need to upload also.… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
This program will look for an individual character, called
This program will look for an individual character, called the key character, inside a target string. It will then perform various functions such as replacing the key character with a dash (-) whereve… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
I am trying to write a CResistor.h file. but keep getting compile
I am trying to write a CResistor.h file. but keep getting compile errors and I need help resolving them. I have the code in a .txt file and I am using Visual Studio 2010 Assignment: Objective: Create … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
Part 1: Write a program called Checkinput, that asks the
Part 1: Write a program called Checkinput, that asks the user to input a value that represents weeks. Calculate and display the number of days in those weeks. Ask the user if he/she wants to input ano… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
1. (TCO 4) What is the bit pattern in data after the
1. (TCO 4) What is the bit pattern in data after the following statements execute? unsigned int data = 10; data = data | 0x0B; data = data << 1; (Points : 7) 0x314 0x154 0x342 0x156 2. (TCO 4) I… read more
Raj
Raj
SAP ABAP Consultant
Master\u0027s Degree
27 satisfied customers
For LogicPro only. Assignment 3 - simple String Class ________________________________
For LogicPro only. Assignment 3 - simple String Class ________________________________________ Necessary skills: class design, abstraction/encapsulation, constructors, destructor, heap memory manageme… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
I have a lab for my c++ class and I do not know where to begin:Lab
I have a lab for my c++ class and I do not know where to begin: Lab 2 - Objective - To exercise some of the C++ I/O stream formatting options and to compose, manipulate and format computed values of a… read more
Ingo U
Ingo U
Master\u0027s Degree
358 satisfied customers
Grading Summary These are the automatically computed results
Grading Summary These are the automatically computed results of your exam. Grades for essay questions, and comments from your instructor, are in the "Details" section below. Date Taken: 12/19/2012 Tim… read more
Raj
Raj
SAP ABAP Consultant
Master\u0027s Degree
27 satisfied customers
Need a flowchart Raptor that requests a password XXXXX verifies
Need a flowchart Raptor that requests a password XXXXX verifies that it is a valid passsword. It has to be at Least 6 characters long and have at least one digit. 1.Determine whether it is valid. If n… read more
ATLProg
ATLProg
Sr Software Engineer
Master\u0027s Degree
46 satisfied customers
Create the project named TimeAtJob_yourLastName then copy the
Create the project named TimeAtJob_yourLastName then copy the following lines of code in. The statemens in this program are not in the correct order. Rearrange the statement so that the program output… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
here is what is missing 1.There is no extPersonType class.
here is what is missing 1.There is no extPersonType class. 2.AddresType class does not use the personType class. 3.No main method. 4.Addressbook does not contain scope for 500 entries. 5.None of the f… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
i have some code and basically i want to convert it to functions
i have some code and basically i want to convert it to functions and i dont know how This is it: #include #include using namespace std; int main () { const int MAX_WORD_SIZE = 6; const int MAX_MISS_CO… read more
jatechexpert
jatechexpert
Master\u0027s Degree
1 satisfied customers
Note that an ordinary telephone book is not suited for retrieval
Note that an ordinary telephone book is not suited for retrieval of a name for a particular number, at least not by a human user. However, a computer can compare numbers as easily and as quickly as na… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
Hello,I need some help with my program (using array of
Hello, I need some help with my program (using array of strings in C++). I need to be helped within 24 hours. Thank you!… read more
Fermat
Fermat
Master's Degree
17 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x