Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 11, Problem 4PP

Enhance the definition of the class StringVar given in Displays 11.11 and 11.12by adding all of the following:

  • Member function copyPiece, which returns a specified substring; member function oneChar, which returns a specified single character; and member function setChar, which changes a specified character
  • An overloaded version of the == operator (note that only the string values have to be equal; the values of maxLength need not be the same)
  • An overloaded version of + that performs concatenation of strings of type StringVar
  • An overloaded version of the extraction operator >> that reads one word (as opposed to inputLine, which reads a whole line)

    If you did the section on overloading the assignment operator, then add it as well. Also write a suitable test program and thoroughly test your class definition.

Blurred answer
Students have asked these similar questions
Write a class BCheckString that is derived from the STL string class. This new class will have two member functions: A) A BCheckString(string s) constructor that receives a string object passed by value and passes it on to the base class constructor.B) An char operator[](int k) function that throws a BoundsException object if k is negative or is greater than or equal to the length of the string. If k is within the bounds of the string, this function will return the character at position k in the string. You will need to write the definition of the BoundsException class. Test your class with a main function that attempts to access characters that are within and outside the bounds of a suitably initialized BCheckString object.
Poker card in PythonLet the CarteBase class present itself in the context of this exercise. It encapsulates a game card characterized by numerical values for its face and its kind. The possible faces are integers from 1 to 13, with face 1 corresponding to the ace, and faces 11, 12 and 13 corresponding respectively to the jack, the queen and the king. The other faces are simply identified by their number from 2 to 10. The possible grades are integers from 1 to 4 corresponding respectively to the cards of spade, heart, tile and clover. Analyze this class to understand how it works. You are asked to create a class called CarteDePoker that inherits CarteBase and defines or redefines the following methods: force(self) which returns the strength of the card in the poker game. In Poker, cards have the strength of their digital face from 2 to 13, except for the ace which is stronger than the other cards. So we give it a strength of 14.__eq__(self, other) to define operator behavior…
Define class StringCheck with required instance variables 2) The StringCheck class should have six methods to do the below functions. I. Check if the user entered string is a s imple sentence? ( Starts with capital letter, Ends with period, space between words). II. Check if the user entered string is a q uestion? (Check if the string starts with a c apital letter, ends with a question mark, space between words) - III. Check if the user entered string have numbers in it ? - IV. Check if string is a valid email . – V. Check if the user entered strings ( two separate string s) are same? – VI. A method to check if the user entered character is present in the user entered string. Add a second constructor to initialize string and character when object is created. – 3) Comment all the parameters used using @param and return value using @return before each method, to explain the parameters passed and the return value . 4) Write a Main class with the main function to accept string/s from the…

Chapter 11 Solutions

Problem Solving with C++ (10th Edition)

Ch. 11.1 - Given the following definitions: const int x = 17;...Ch. 11.2 - What is the difference between a (binary) operator...Ch. 11.2 - Prob. 13STECh. 11.2 - Suppose you wish to overload the operator = so...Ch. 11.2 - Prob. 15STECh. 11.2 - Give the definition for the constructor discussed...Ch. 11.2 - Here is a definition of a class called Pairs....Ch. 11.2 - Following is the definition for a class called...Ch. 11.3 - Give a type definition for a structure called...Ch. 11.3 - Write a program that reads in five amounts of...Ch. 11.3 - Change the class TemperatureList given in Display...Ch. 11.3 - Prob. 22STECh. 11.3 - If a class is named MyClass and it has a...Ch. 11.4 - Prob. 24STECh. 11.4 - The following is the first line of the copy...Ch. 11.4 - Answer these questions about destructors. a. What...Ch. 11.4 - a. Explain carefully why no overloaded assignment...Ch. 11 - Modify the definition of the class Money shown in...Ch. 11 - Self-Test Exercise 17 asked you to overload the...Ch. 11 - Self-Test Exercise 18 asked you to overload the...Ch. 11 - Prob. 1PPCh. 11 - Define a class for rational numbers. A rational...Ch. 11 - Define a class for complex numbers. A complex...Ch. 11 - Enhance the definition of the class StringVar...Ch. 11 - Define a class called List that can hold a list of...Ch. 11 - Define a class called StringSet that will be used...Ch. 11 - This programming project requires you to complete...Ch. 11 - Redo Programming Project 6 from Chapter 9 (or do...Ch. 11 - Solution to Programming Project 11.12 To combat...Ch. 11 - Repeat Programming Project 11 from Chapter 10 but...Ch. 11 - Do Programming Project 19 from Chapter 8 except...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY