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

a program that asks for the number of tickets sold and computes the total cost of the purchase at Walt Disney World based on the following information:

 

Walt Disney World sells tickets for $109 per day. Discounts are given for purchasing multiple days of tickets at the same time. The discounts are given according to the following table:


Draw the (1)stack and (2)circular queue data structures in array implementation for "each step" in the following sequence :add(A),add(B), add(C), remove, add(D), add(E), remove, add (F), add(G). Assume the initial size of 5 for array implementation. Remember to show TOP(top of the stack) for stack and both Front and back for queue. In circular queue implementation assume we sacrifice one storage for telling the difference between FULL and EMPTY.


Write a function in C++ to calculate product of digits of any number


Write a function in C++ to print the Floyd's Triangle.


1 Write a function in C++ to find the factorial of a number (using while loop).


Develop a program called National_lottery that determines the winning lottery numbers. The program must use the rand function to produce six(6) random numbers between 0 & 49 & number must not repeat. The numbers are generated by a user by clicking a button called Generate six(6) numbers.

-Then use an appropriate pointer operator to print the addresses of the numbers in memory & must be expressed in hexadecimals.

-use the derefencing operatorto point to values contained within the addresses. Use the function sort with begin() & end() function.

-Then assign the values into an array called winning_numbers. Use the for statement or the initialiser list to initialise the numbers into the array. Search the winning_numbers for any two(2) array elements(subscripts) that give the sum of >= 80 when added together, if the numbers >= 80 are more than one(1) set, consider the biggest set to be the one chosen for draw


2. In Q1, add default as well as parameterized constructors in both base & derived class. Create object of Alarm_Clock class. Make it to call parameterized constructors of base as well as derived. Add destructors also. Check the order of destructors when derived class object goes out of scope.
Implement a single inheritance program where base class is Clock & derived class is Alarm_Clock . Base class should have at least one member with private access, one member with protected access, one with public access. Clearly differentiate between different access specifiers. While designing classes make sure you add valid data members & member functions. Also try to analyze the difference between private, public & protected mode of inheritance.

3 Create a class called 'TIME' that has three integer data members for hours, minutes and seconds, a constructor to initialize the object to some constant

value, member function to add two TIME objects, member function to

display time in HH:MM:SS format. Write a main function to create two

TIME objects, add them and display the result in HH:MM:SS format.


Sample Run 1

Welcome to CS126 Mart!

Item Codes Description Price

100 Sweet ‘n Ripe Grapes 125.35

101 Crunchy Apples 52.20

109 Green Peas 25.75


Enter Code: 128

Invalid code. This program will exit.


Sample Run 2

Welcome to CS126 Mart!

Item Codes Description Price

100 Sweet ‘n Ripe Grapes 125.35

101 Crunchy Apples 52.20

109 Green Peas 25.75


Enter Code: 100

Sweet ‘n Ripe Grapes 125.35

Quantity -3

Invalid quantity


LATEST TUTORIALS
APPROVED BY CLIENTS