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

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


Write a pseucode on the following the user to select an item (vote) from a group of items that are presented select an item (vote) from a group of items that are presented. You should use your own choice of holiday destinations.
For example, the voting options might look like:
Please choose your favorite holiday destination from the list above by number.
Note that the sixth menu item is the option to quit voting. If this option is selected, voting results (as discussed in
the next paragraph) need to be printed before the program terminates.

*********** FAVORITE HOLIDAY DESTINATION OPINION POLL ***********
ITEM VOTES %
London 5 33.3
Paris 3 20.0
Rome 3 20.0
Sydney 1 6.7
New Zealand 3 20.0
According to this Poll, the destination with majority of votes is London.
Total Valid Votes: 15
Total Invalid Votes: 2 Total votes received: 17

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.


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.

2 (Multilevel Inheritance) Modify the program no. 1 as follows:

Derive a class named as BOX from RECTANGLE class. Take necessary

data & member functions for this box class to calculate the volume of the

box. All the data members are initialized through the constructors. Show the

result by accessing the area method of circle and rectangle and the volume

method of box class through the objects of box class.


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


Write a program that prompts the user to input the shape type such as circle,

rectangle, and rectangular prism and the appropriate dimension of the shape. The

program then outputs the following information about the shape: For a circle, it outputs

the area and circumference; for rectangle, outputs the perimeter and area, and for a

rectangular prism, outputs the volume and surface area.
Write a program that prompts the user to input the shape type such as circle,

rectangle, and rectangular prism and the appropriate dimension of the shape. The

program then outputs the following information about the shape: For a circle, it outputs

the area and circumference; for rectangle, outputs the perimeter and area, and for a

rectangular prism, outputs the volume and surface area.
LATEST TUTORIALS
APPROVED BY CLIENTS