C++ Answers

Questions answered by Experts: 9 913

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

Write a program to create a class CIRCLE with one

field as radius, used to calculate the area of a Circle. Create another class

RECTANGLE used to calculate the area of the rectangle which is a subclass

of CIRCLE class. Use the concept of single inheritance such that the radius

of circle class can be re-used as length in rectangle class. Take necessary

data members and member functions for both the classes to solve this

problem. All the data members are initialized through the constructors.

Show the result by accessing the area method of both the classes through the

objects of rectangle class.


Bianca is preparing special dishes for her daughter’s birthday.

It takes her a minutes to prepare the first dish, and each following dish takes b minutes longer than the previous dish. She has t minutes to prepare the dishes.

For example, if the first dish takes a = 10 minutes and b = 5, then the second dish will take 15 minutes, the third dish will take 20 minutes, and so on.

If she has 80 minutes to prepare the dishes, then she can prepare four dishes because 10 + 15 + 20 + 25 = 70.

Write a program that prompts the user to enter the values of ab, and t, and outputs the number of dishes Bianca can prepare.


Write a program called National_lottery. it should use rand function to produce 6 random numbers to 0 & 49, number must not repeat. use an appropriate pointer to print address of numbers in memory and its must be in hexadecimal. use derefencing operator to point in address. use function sort with begin() & end() function to organise values in ascending order, use a for statement to intialise numbers into arrays. Search any 2 array element that give sum of >=80 when + together, if numbers >=80 are more than 1 set, consider the biggest set chosen for draw. if the value of sum of the 2 are >=80, print "You won" & if they are < 80, print "You loose". Amount won by custom made function "amountDeterminat" of type & double argument in prototype. argument will be winning number received from sum of 2. amountDeterminant must use switch conditions. if winning numbers is (80 & 83 won amount 1700000, 84 & 86 amount 2500000, 87 & 89 amount 16000000)


Note:
You are instructed not to write the code. Otherwise you will be awarded 0 marks.

Given the following AVL tree, delete node 3 and rebalance the tree if required. State clearly which rotations you applied to which Nodes. Draw resultant tree after every step.
root=5
root->left =3
root->left->left=2
root->left->left->left=1
root->left->right =4
root->right =8
root->right->left=7
root->right->left->left =6
root->right - >right=10
root->right->right->left=9
root->right->right->right =11
root->right->right->right->right =12
Note: No code required.

The binary search tree shown below was constructed by inserting a sequence of items into a empty tree.
root=5
root->left=3
root->left->right=4
root->right=9
root->right->left=7
root->right->left->left=6
root->right ->left->right=8
root->right->right=12
root->right->right->right=20

Which of the following input sequences will not produce this binary search tree?
1)5 3 4 9 12 7 8 6 20
2)5 9 3 7 6 8 4 12 20
3)5 9 7 8 6 12 20 3 4
4)5 9 7 3 8 12 6 4 20
5)5 9 3 6 7 8 4 12 20
Verify it by doing rough work below others you will get 0 marks.

 implementation of the functions of an arrayList


Note: No code is needed.

Write the following infix expression into prefix expression :
(((a-g) +(e/b))*c)
Also write each step
2 Write a program to perform addition of two complex numbers using
constructor overloading.The first constructor which takes no argument is
used to create objects which are not initialized, second which takes one
argument is used to initialize real and imaginary parts to equal values and
third which takes two argument is used to initialize real and imaginary to
two different values.
2 Write a program to perform addition of two complex numbers using
constructor overloading.The first constructor which takes no argument is
used to create objects which are not initialized, second which takes one
argument is used to initialize real and imaginary parts to equal values and
third which takes two argument is used to initialize real and imaginary to
two different values.

1.Create a class to implement a queue using a circular array


a.The class should contain functions to

i.Insert a new value,

ii.Delete a value.

iii.Change a value equal to X to a value equal to Y.

iv.Count all value equal to X in the queue.

b.For each function above perform an asymptotic analysis and state the worst case performance of the algorithm


LATEST TUTORIALS
APPROVED BY CLIENTS