Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program which reads a C++ source file and checks that all instances of brackets are balanced, that is, each ‘(’ has a matching ‘)’, and similarly for [] and {}, except for when they appear inside comments or strings. A line which contains an unbalanced bracket should be reported by a message such as the following sent to standard output: '{' on line 15 has no matching '}'


Write a program that will display the following pattern, given the value of n and m. Example if n = 5,and m=6, output


Write the definition of the function, leavesCount, that takes as a parameter a pointer to the root node of a binary tree and returns the number of leaves in a binary tree. Add this function to the class binaryTreeType and create a program to test this function


The binary tree of Figure 11-35 is to be used for Exercises 9 through 13.

13. Delete nodes 80 and 58 in that order. Redraw the binary tree after each deletion.

15. The nodes in a binary tree in preorder and inorder sequences are as follows: preorder: ABCDEFGHIJKLM inorder: CEDFBAHJIKGML Draw the binary tree


Build a patient base class consisting of

Attributes: full name (string), hometown (string), year of birth (int)

Functions: Create, import, and export information

Build a medical record class that inherits public from the patient class, adding:


Attributes: medical record name (string), hospital charge amount (double)

Functions: Create, import, export information, calculate current age.

Write a main program that does:


Enter a list of N medical records

Sort the list by descending age of the patients

Display the list of patients with age <=10

Show information of the patients with the highest hospital fees


Implement the class ComplexNumber, the real and imaginary parts of the complex number can

be int, float or double. Overload operators +,-,*,~

Generalize this class into template, and write appropriate main function to test it.

#include

usingnamespace std;

template

class ComplexNumber

{

public:

void print() const;

/* prints the complex number */

ComplexNumber();

/* constructor */

ComplexNumber(T, T);

/* constructor with parameters */

ComplexNumber operator + (ComplexNumber); /*overload + */

ComplexNumber operator - (ComplexNumber); /*overload - */

ComplexNumber operator * (ComplexNumber); /*overload * */

void operator ~ (); /*overload ~, takes complex conjugate of calling

complexnumber, i.e. a+iba-ib*/

private:

T a; /*real part of complex numeber*/

T b; /* imaginary part of complex numeber */

};


Write a class LocalPhone that contains an attribute phone to store a local telephone number. The class contains member functions to input and display phone number. Write a child class NatPhone for national phone numbers that inherits LocPhone class. It additionally contains an attribute to store city code. It also contains member functions to input and show the city code. Write another class IntPhone for international phone numbers that inherit NatPhone class. It additionally contains an attribute to store country code. It also contains member functions to input and show the country code. Test these classes from main() by creating objects of derived classes and testing functions in a way that clear concept of multi-level Inheritance


Start with the publication, book and tape classes. Add base class sales that holds an array of three floats so that it can record the dollar sales of a particular publication for the last three months. Include a getdata() function to get three sale amount from the user and a putdata() function to display the sales figure. Alter the book and tape classes, so they are derived from both publication and sales. An object of book or tape should input and output and sales data along with other data. Write a main function to create a book and tape object and exercise their input/output capabilities


An organization has two types of employees: regular and adhoc. Regular employees get a salary which is basic + DA + HRA where DA is 10% of basic and HRA is 30% of basic. Adhoc employees are daily wagers who get a salary which is equal to Number * Wage.

Define the constructors. When a regular employee is created, basic must be a parameter. When adhoc employee is created wage must be a parameter. (iii) Define the destructors. (iv)Define the member functions for each class. The member function days ( ) updates number of the Adhoc employee. (v) Write a test program to test the classes


 derive a class hierarchy for the item set given below



Item sets:


Engine , InternalCombustineEngine , ExternalCombustineEngine , PetrolEngine, DieselEngine, SteamEngine | Virtual Function GetEfficiency()



LATEST TUTORIALS
APPROVED BY CLIENTS