All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
computer science
a practical in depth guide c++
Questions and Answers of
A Practical In Depth Guide C++
Modify and augment your \(\mathrm{C}++\) program from Chapter 3, Indirect Addressing - Pointers, Question 1 as follows:1. Overload your Read Data () function with a version that accepts a student
Replace your template Array class from, Working with Templates, with an STL vector. Create a vector of student instances. Use vector operations to insert, retrieve, print, compare, and remove objects
Modify the queue example from this chapter to instead utilize priority_queue. Be sure to make use of the priority enqueueing mechanism priority_queue: : emplace () to add elements into the
Try out an STL algorithm using sort (). Be sure to # include . Sort an array of integers. Keep in mind that many containers have sorting mechanisms built in, but native collection types, such as a
Consider a pair of classes from one of your previous exercises containing an object relationship.1. Do your classes follow the canonical class form? Orthodox or extended? Why, or why not? If they do
Create a driver (or two) to test your pair of classes:1. Be sure to test for the usual checklist of items (construction, assignment, destruction, the public interface, upcasting (if applicable), and
Create a Construction Exception class (derived from the C++ Standard Library exception). Embed checks within your constructors in a sample class to throw a Construction Exception when necessary. Be
Using the online code for the example in this chapter as a starting point and the solution from a previous exercise.1. Implement (or modify your previous) Student: :DropCourse (). When a student
What other examples can you imagine that might easily incorporate the Observer pattern?
Using the solution from a previous exercise, augment your code as follows:1. Implement the Factory Method pattern to create various shapes. You will have already created an abstract base class of
What other examples can you imagine that might easily incorporate the Factory Method pattern?
Using the Adapter examples found in this chapter, create a program as follows:1. Implement a Citizen Data Base that stores various types of Humanoid instances (Orkan, Romulan, Earthling, and perhaps
What other examples can you imagine that might easily incorporate the Adapter pattern?
Using the Singleton pattern examples found in this chapter, create a program to accomplish the following:1. Implement either an interface for a President to Resign() or implement the interface to
Why can you not label the static instance() method as virtual in Singleton and override it in President?
What other examples can you imagine that might easily incorporate the Singleton pattern?
Modify the pImpl pattern example in this chapter, which uses a unique pointer to additionally introduce unique pointers within the implementation of the nested class.
Revise your Student class from a previous chapter solution to simply inherit from the Person class in this chapter that embraces the pImpl pattern. What difficulties, if any, do you have? Now, modify
What other examples can you imagine that might reasonably incorporate the pImpl pattern for relative implementation independence?
Describe a situation in which flush, rather than endl, may be useful for clearing the contents of the buffer associated with cout.
The unary operator ++ can be used as a pre- or post-increment operator, such as i++ or ++i. Can you describe a situation in which choosing a pre- versus post-increment for ++ would have different
Create a simple program using a struct or class to make a user defined type for Book. Add data members for title, author, and number of pages. Create two variables of type Book and use the dot
What is the signature of a function and how is a function's signature related to name mangling in \(\mathrm{C}++\) ? How do you think this facilitates how overloaded functions are handled internally
Write a small \(\mathrm{C}++\) program to prompt a user to enter information regarding a student, and print out the data. Use the following steps to write your code:1.) Create a data type for student
Write the following pointer declarations that include a const qualification:1. Write a declaration for a pointer to a constant object. Assume the object is of type student. 2. Write a declaration for
Why does passing an argument of type const student * to Print () in your preceding program make sense, yet passing a parameter of type Student * const does not make sense?
Can you think of programming situations that may require a dynamically allocated 3-D array? What about a dynamically allocated array with more dimensions?
Create a C++ program to encapsulate a student. You may use portions of your previous exercises. Try to do this yourself, rather than relying on any online code. You will need this class as a basis to
Using your Chapter 5, Exploring Classes in Detail, solution, create a \(\mathrm{C}++\) program to build an inheritance hierarchy, generalizing person as a base class from the derived class of
(Optional) Complete the class hierarchy, which includes Link List, Queue, and Priority queue, using the online code as a basis. Complete the remaining operations in the Link List class, and call them
Implementing Hierarchies with Single Inheritance, solution, augment your inheritance hierarchy to further specialize student with Graduate Student and Non-Degree Student.1. Add necessary data members
Create a hierarchy of shapes using the following guidelines:1. Create an abstract base class called shape, which defines an operation to compute the area of a shape. Do not include a method for the
Type in (or use the online code) for the diamond-shaped hierarchy example in this chapter that uses virtual base classes. Run it as is. Hint: you may want to add explicit destructors with cout
Now, remove the keyword virtual from the base class list of Person and Horse (that is, LifeForm will no longer be a virtual base class of Person and Horse. LifeForm will just be a typical base class
Add an additional student constructor to the university/student example to accept the university constructor argument by reference, rather than by pointer. For example, in addition to the constructor
Write a \(\mathrm{C}++\) program to implement a many-to-many association between objects of type course and of type student. You may choose to build on your previous programs that encapsulate
(Optional) Enhance your program to gain experience with backlink maintenance and reference counting as follows:1. Implement a DropCourse () interface for student. That is, create a Student: :
Add exception handling to your previous Student, Implementing Association, Aggregation, and Composition, as follows:1. Should a student try to enroll in more than the Max defined number of allowable
Overload operator= in your shape exercise from Chapter 8, Mastering Abstract Classes, or alternatively, overload operator= in your ongoing LifeForm/Person/Student classes as follows:Define operator=
Overload operator
Create an ArrayInt class to provide safe integer arrays with bounds checking. Overload operator [] to return an element if it exists in the array, or throw an exception if it is outofBounds. Add
Convert your Arrayint class from, Friends and Operator Overloading, to a template Array class to support a dynamically allocated array of any data type that can be easily resized and has builtin
Using the template LinkList class, complete the implementation for LinkList: : OrderedInsert (). Create a LinkList of student instances in main(). After several student instances have been inserted