Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 17 Sentence Parsing Function CSCI 111 Programming and Algorithms I Due Friday March 12, 11:59pm on turnin 10 Points NEW CONCEPTS: The following is

Lab 17

Sentence Parsing Function

CSCI 111 Programming and Algorithms I

Due Friday March 12, 11:59pm on turnin

10 Points

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

lab17.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 on https://turnin.ecst.csuchico.edu/ and get a successful message

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions