Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

Homework
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 24 days 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 24 days 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 24 days 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,278
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 23 days 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,278
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 22 days ago
Sorry for replying so late, can you finish it by 11:59 pm
Customer reply replied 22 days ago
hello
Customer reply replied 22 days 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 22 days 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 22 days ago
how about this one
Customer reply replied 22 days ago
this is data file

How many hours are left for deadline?

Ask Your Own Homework Question
Customer reply replied 22 days ago
actually one hour
Customer reply replied 22 days 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 22 days 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 21 days ago
I got it
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
Ask Your Own Homework Question
Ask LogicPro Your Own Question
LogicPro
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,278
13,278 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,278 satisfied customers

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

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,550 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,635 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,159 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
Questions 1–20: Select the one best answer to each question.
Questions 1–20: Select the one best answer to each question. Questions 1–4 are based on the following set of facts. You're a paralegal in the ADR practice at a large law firm. John B, a new client, ha… read more
P. Simmons
P. Simmons
Attorney
Doctoral Degree
141 satisfied customers
Question 6 of 20: Select the best answer for the question.
Question 6 of 20 : Select the best answer for the question. 6. An attorney receives a discovery request for documents. The requested documents contain some material that's discoverable and some materi… read more
Lucy
Lucy
Juris Doctor
128 satisfied customers
I am having issues with a piece of Java code. I am working
I am having issues with a piece of Java code. I am working with arrays and need to store the arrays location calls to then print out a summary or all the calls made in a session.… read more
LogicPro
LogicPro
Engineer
13,278 satisfied customers
Write a Java application using NetBeans Integrated
Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn… read more
LogicPro
LogicPro
Engineer
13,278 satisfied customers
Step 1: Define a Computer class that can be used to describe
Step 1: Define a Computer class that can be used to describe your computer. The class must have at least two attributes. One variable must be an integer data type and the other must be a String data t… read more
LogicPro
LogicPro
Engineer
13,278 satisfied customers
1. Which of the following devices contains three PN
1. Which of the following devices contains three PN junctions? A. Backward diode B. TRIAC C. Shockley diode D. DIAC2. A diode's recovery time is divided into two parts called the A. a-b period and the… read more
GLENN
GLENN
Master of Mathematics
335 satisfied customers
Two-dimensional array operations in C++: Movie Ratings
Two-dimensional array operations in C++ : Movie Ratings program** You have recently collected reviews from four movie reviewers where the reviewers are numbered 1- 4. Each reviewer has rated six movie… read more
George Sibiya
George Sibiya
PhD
197 satisfied customers
Chief Justice Marshall emphasized that the Constitution gave
Chief Justice John Marshall emphasized that the Constitution gave Congress the power to make all “necessary and proper laws” needed to carry out its delegated powers. How did the necessary and proper … read more
Jane T (LLC)
Jane T (LLC)
Master\u0027s Degree
5,402 satisfied customers
I need help on my computer science homework using python i
I need help on my computer science homework using python i have hit a speed bump and do not understand what i am doing with my functions anymore... i feel like all my files are set and i have red the … read more
LogicPro
LogicPro
Engineer
13,278 satisfied customers
Need help with Wireshark. Approx 40 questions. Entry level
Need help with Wireshark. Approx 40 questions. Entry level class but must know how to do tasks. It is not something that you can just google the answers. Need assignment completed soon. Will pay good … read more
David L.
David L.
Bachelor\u0027s Degree
6 satisfied customers
Which type of behaviorism is represented by the following
Which type of behaviorism is represented by the following quotation? “It is a mistake to rule out events that influence our behavior because they are not accessible to others.” a.Structuralism b.Metho… read more
ABC Accounting Group
ABC Accounting Group
Bachelor\u0027s Degree
682 satisfied customers
How are you doing? I am working on an assignment in
Hi how are you doing? I am working on an assignment in Javascript. I have both the container file and the code. However, I couldn't get the program to run. The error is in the actual html file. I am u… read more
LogicPro
LogicPro
Engineer
13,278 satisfied customers
I need help with this same question. Python and raptor.
Final Programming Project Assessment (400 Points toward Course Grade) Instructions: The following programming problem can be solved by a program that uses three basic tasks-Input Data, Process Data, and Output Results. To process the data, use file, looping, array, decision, accumulating, counting, find min/max and sorting techniques. First, create an MS Word document containing a hierarchy chart to organize your program modules. Second, create a RAPTOR flowchart to solve this problem. Third, create the program with Python. You MUST use Modular Programming techniques by using Sub Modules in your program. Your "main" module should not be very large. NEVER call "main" from inside your program. Also, do not use "recursion" in this program (submodules that call themselves). You are only allowed to use looping techniques to repeat sections of your submodules. Problem Statement Ledger's Furniture Store has 10 salespeople. Ledger's wants to produce a combined monthly sales report for all salespeople. Ledger's wants you to write a program that will allow them to enter data in any order, save the unsorted data to a file, and then produce a file in alphabetical order by name of the salespeople. The unsorted output file should be named "sales_unsorted.txt" and the sorted file should be named "sales_sorted.txt". … read more
George Sibiya
George Sibiya
PhD
197 satisfied customers
An orange juice producer buys oranges from a large orange
An orange juice producer buys oranges from a large orange grove that has one variety of orange. The amount of juice squeezed from these oranges is approximately normally​ distributed, with a mean of 6.06.0 ounces and a standard deviation of 0.240.24 ounce. Suppose that you select a sample of 3636 oranges. a. What is the probability that the sample mean amount of juice will be at least 5.685.68 ​ounces? b. The probability is 7676​% that the sample mean amount of juice will be contained between what two values symmetrically distributed around the population​ mean? c. The probability is 7575​% that the sample mean amount of juice will be greater than what​ value? … read more
GLENN
GLENN
Master of Mathematics
335 satisfied customers
Describe the relationship of the NBPTS to learning theories
describe the relationship of the NBPTS to learning theories and educational environments compare the advantages and disadvantages of traditional and nontraditional learning environments for students w… read more
lani_s
lani_s
Bachelor\u0027s Degree
47 satisfied customers
Physics Orbiting Bodies Calculate the mass (in kg) of the
Physics Orbiting BodiesCalculate the mass (in kg) of the Sun based on data for Venus's orbit. (answer in kg) Compare the value obtained with the Sun's actual mass. M obtained/ M actual… read more
GLENN
GLENN
Master of Mathematics
335 satisfied customers
Your instructor will assign a linear programming project for
Your instructor will assign a linear programming project for this assignment according to the following specifications.It will be a problem with at least three (3) constraints and at least two (2) dec… read more
GLENN
GLENN
Master of Mathematics
335 satisfied customers
I want to ask the problems about python. It's about the
Hello, I want to ask the problems about python JA: What's your objective for this Python project? Customer: It's about the function and subclass JA: Anything else you want the programmer to know befor… read more
George Sibiya
George Sibiya
PhD
197 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