Write a program for a publishing company that markets both printed books and audio visual
lectures stored on CDs. Write a class Publication thatstores title and price. Derive a class book which
has an additional member as no_pages and a class Lecture with member play_time.
Create a base class called Radix10 which has a member function decimal. It can be set and display
by member functions. It also contains a virtual function called convert. Derive two classed from
Radix10. One is called Radix2 and the next is called Radix16. They redefine the convert function
such that the decimal value is displayed into binary or hexa_decimal. They have a data member
length which can be set by member functions. To convert the decimal data is divided by appropriate
radix length times and the remainder which is always from 0 to (radix-1) should be displayed in
reverse order. In hexa decimal, for remainder 10, 11, 12 ,13, 14 and 15 the codes A, B, C, D, E or F
should be used respectively.
Write a program having classes Rectangle with data member length and width ,square with data member side .Equalitrial Triangle with data member sides.All these classes are derived from class shape.Write an independent function which will exhibit polymorphism and show thr area of the object passed to the function.All the data memebers of class are private you can write suitable function needed for you
CODE MEAL NAME PRICE (RM)
1 Chicken Fillet 15.00
2 Roasted Beef 20.00
3 Rib eye Fillet 30.00
CODE BEVERAGE NAME PRICE (RM)
S Syrup 1.50
L Lychee 2.80
C Coconut 3.50
i. The customer order the meal and beverage based on the code
ii. system will ask the quantity for each order
iii. displays the quantity and the total price of the meal
iv. displays the quantity and the total price of the beverage
v. displays the total price that the user needs to pay
vi. The system will repeat the process i to v until user put ‘N’ to stop the program
SAMPLE OUTPUT :
CODE MEAL NAME PRICE(RM)
1 Chicken fillet 15.00
2 Roasted Beef 20.00
3 Rib eye fillet 30.00
Enter your meal code: 2
Enter quantity for the meal: 5
Describe the syntactically way to declare and initialize in a single step a pointer to a previously
declared variables m and b for type float and double?
Write a program to display the output as "Hello World" and "Hello Name" where Name is the input from the user.
Write a c++ program that contains
-a function that that compare two singly Linked lists
-a function that swaps the values inside them
-a function that sorts the values inside them in ascending order
QUESTION 30
After the following statements execute, what are the contents of matrix?
int matrix[3][2];
int j,
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
matrix[j][k] = j + k;
1. 0 0
1 1
2 2
2. 0 1
2 3
4 5
3. 0 1
1 2
2 3
4. 1 1
2 2
3 3
QUESTION 28
Consider the following statement:
int alpha[25][10];.
Which of the following statements about alpha is true?
1. Rows of alpha are numbered 0...24 and columns are numbered 0...9.
2. Rows of alpha are numbered 0...24 and columns are numbered 1...10.
3. Rows of alpha are numbered 1...24 and columns are numbered 0...9.
4. Rows of alpha are numbered 1...25 and columns are numbered 1...10.
QUESTION 29
Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the
element type int?
1. int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
2. int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
3. int alpha[4][3] = {0,1,2:1,2,3:2,3,4:3,4,5};
4. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};
QUESTION 24
Consider the following declaration
int alpha[5] = {3, 5, 7, 9, 11};
Which of the following is equivalent to this statement?
1. int alpha[] = {3, 5, 7, 9, 11};
2. int alpha[] = {3 5 7 9 11};
3. int alpha[5] = [3, 5, 7, 9, 11];
4. int alpha[] = (3, 5, 7, 9, 11);
QUESTION 25
Which of the following correctly declares name to be a character array and stores "William" in it?
1. char name[6] = "William";
2. char name[7] = "William";
3. char name[8] = "William";
4. char name[8] = 'William';
QUESTION 26
Consider the following statement:
float alpha[10][5];
The number of elements of alpha is ____.
1. 15
2. 50
3. 100
4. 150
QUESTION 27
Consider the statement
int list[10][8];
Which of the following about list is true?
1. list has 10 rows and 8 columns.
2. list has 8 rows and 10 columns.
3. list has a total of 18 elements.
4. list has a total of 108 elements.