Absolute C++
Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 4PP

Cumulatively modify the example from Display 8.7 as follows.

  1. In Display 8.7, replace the private char members first and second with an array of char of size 100 and a private data member named size. Provide a default constructor that initializes Size to 10 and sets the first 10 of the char positions to • . (This only uses 10 of the possible 100 slots.) Provide an accessor function that returns the value of the private member size.
  2. Test.

  3. Add an operator member that returns a char& that allows the user to access or to set any member of the private data array using a non-negative index that is less than size.
  4. Test.

  5. Add a constructor that takes an int argument, sz, that sets the first sz members of the char array to ' # '.
  6. Test.

  7. Add a constructor that takes an int argument, sz, and an array of char of size sz. The constructor should set the first sz members of the private data array to the sz members of the argument array of char.
  8. Test.

NOTES: When you test, you should test with known good values, with data on boundaries and with deliberately bad values. You are not required to put checks for index out of bounds errors in your code, but that would be a nice touch. Error handling alternatives: Issue an error message then die (that is, call exit (1)) or give the user another chance to make a correct entry.

Blurred answer
Students have asked these similar questions
You are required to design an Movie class which has following attributes          String name;          String Director;          String release_Date;          Int duration; 1. Provide default & Parameterized constructors. 2. Provide getters & setters for data members. 3. Provide a toString() method to print values.  Now create an array of items store values in it (take values form user). After that you have to print the following 1. All the movies in the array. 2. Movie whose name starts with ‘a’; 3. Movie whose director name end with “m”. 4. All the movies having released on 28-3-2021. 5. Movie with longest duration.     Programming language :Java
Create a class called Book. The class will contain data members for name, publisher, author, pages andprice. All the data member should be private, except the price, which is to be public. There should be a display()function to show the contents of each object (Book). Your task is to create ARRAY of 10 objects of Book classin main() and provide different values to each object using getData(). There should be a function isOersize()returning true if the number of pages is greater than 500 otherwise false. Also call this function for each object todisplay the message “Oversized” or “NOT Oversized”. The Details of objects should be displayed as well in themain(). Access data members and/or member functions using Pointer to Book class only. Use only one pointerand assign the base address of array of objects to it. Accessor and mutator should also be highlighted. Alsofind/accumulate the price of all the objects by accessing the price data members of all objects and display the totalprice.…
Create a class: “Palindrome” with private data members: upper_limit (int), lower_limit (int), and parameterized constructor, which initializes the values of both data members. Apart from initialization, this constructor also displays the count of palindrome numbers from upper_limit to lower_limit. [Example: upper_limit:50, lower_limit:10, count of palindrome numbers is: 4(11, 22, 33 and 44), also make sure the value of upper_limit should be greater than lower_limit].

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
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License