Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEW CONCEPTS: The following is the contents for Makefile ( in vim, tab is inserted with CTRL-V then ) lab17: lab17.o ParseString.o g++ -std=c++11 -o

NEW CONCEPTS:

The following is the contents for Makefile ( in vim, tab is inserted with CTRL-V then )

lab17: lab17.o ParseString.o

g++ -std=c++11 -o lab17 lab17.o ParseString.o l

ab17.o: lab17.cpp

g++ -std=c++11 -o lab17.o -c lab17.cpp

ParseString.o: ParseString.h ParseString.cpp

g++ -std=c++11 -o ParseString.o -c ParseString.cpp

clean:

rm lab17 lab17.o ParseString.o

Header file. Here is an example of a header guard. The following is contents for ParseString.h

#ifndef FN_H

#define FN_H

#include

using namespace std;

string ParseString(string Sentence, int StartIndex, int EndIndex);

#endif

Task list:

1. Completion of this lab will require 4 files: above are the complete listings for Makefile and ParseString.h. It is your task to create lab17.cpp, and ParseString.cpp.

2. lab17.cpp should contain the main function. It will need to prompt the user for a sentence value and two integer values. The ParseString function should then be called and finally, display the return value

3. ParseString.cpp file declares the ParseString function whose object is to return the substring of sentence contents starting at index value StartIndex and ending at index value EndIndex.

4. The ParseString function should also perform error checking and display index out-of-bounds error messages as stated in the sample output below. The string ERROR is returned upon invalid input.

5. Refer to the expected output listing below.

6. Submit your ParseString.cpp file

GRADING

To achieve a maximum score, students will need to clearly prove that they completed the goal.

Points lost for incompleteness, sloppiness, lateness, or failure to follow instructions.

Refer to syllabus for late policy.

SAMPLE OUTPUT

Text in red color should be displayed from the main function

/user/faculty/jraigoza/CSCI111/Labs/lab17 $ ./lab17

Enter a sentence.

Computer Science is fun!

Enter START location value to parse(0-indexed).

2

Enter END location value to parse (0-indexed).

12

OUTPUT = mputer Scie

/user/faculty/jraigoza/CSCI111/Labs/lab17 $ ./lab17

Enter a sentence.

Computer Science is fun!

Enter START location value to parse(0-indexed).

2

Enter END location value to parse (0-indexed).

100

ERROR: END value is greater than the sentence length.

OUTPUT = ERROR

/user/faculty/jraigoza/CSCI111/Labs/lab17 $ ./lab17

Enter a sentence.

Computer Science is fun!

Enter START location value to parse(0-indexed).

12

Enter END location value to parse (0-indexed).

9

Really? START value is greater than the END value.

OUTPUT = ERROR

/user/faculty/jraigoza/CSCI111/Labs/lab17 $ ./lab17

Enter a sentence.

Computer Science is fun!

Enter START location value to parse(0-indexed).

120

Enter END location value to parse (0-indexed).

130

ERROR: START and END values are greater than the sentence length.

OUTPUT = ERROR

/user/faculty/jraigoza/CSCI111/Labs/lab17 $

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Can IT Security be too secure? How?

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago

Question

=+Where do you want to live and work?

Answered: 1 week ago

Question

=+1 Where are the best places in the world to live (and work)?

Answered: 1 week ago

Question

=+Are you interested in working on global teams?

Answered: 1 week ago