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
10. Please do in java code DJ classDesign, implement and test a DJ class. A DJ object has a name - djName and an isHired attribute (boolean). Also, a DJ object has 3 musicTypes. These are references to the Music class, where the musicType is declared. In Stage 2 you will be required to declare these 3 instance variables as 1 array.A DJ object can return the value of each of its attributes, and change the value of each of its attributes. It can also display itself in the form:Kongapa, Play List: Disco, Rap, Heavy Metal is hiredImpressions, Play List: House, Hip Hop, Jazz is available
Task 4. Utility classes Implement a Menu-Driven program of ArrayList class using the above scenario and perform the following operations. a. Create an object of ArrayList class based on the scenario with explanations of the method used. b. Create a method that will allow inserting an element to ArrayList Class based on the scenario. The input field must be validated as necessary. C. Create a method to delete specific elements in the ArrayList with explanations of the method used.
Create a Student class that have two data members id (assign to your ID) and name (assign to your name). Create the object of the Student class by new keyword and printing the objects value. You may name your object as Student1. The output should be like this: 20170500 Asma Zubaida

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
In Exercises 41 through 46, identify the errors.

Introduction To Programming Using Visual Basic (11th Edition)

This operator can be used to determine whether a reference variable references an object of a particular class....

Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)

Determine the force in each member of the truss, and state if the members are in tension or compression Set = ...

INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)

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