You have been developing a small commercial Software for numeric operations. You are working on the calculation of areas and volume of different shapes. Based on your software complete these tasks:
a) Create a function template named as shape() that accepts three arguments in such a way that first and second will be the dimension like base and height and the third will be the name of the shape. The shape() function displays the dimension values and the area of the shape. The function returns the area to the calling program; the area is the same data type as the parameter. [Note: Design a main program such that, it input the values of only those shapes whose area is computable on the bases of base and height only]
b) Create another function template named as show_master()that accepts two arguments. The first is index and the second argument is an array of 10 values. The show_master() function will returns the specified index value.
Answer the following short questions. Your answer should be precise.
a) Can we declare base class constructor or destructor as virtual if yes then why we want to do?
b) How we can declare a class as abstract and why we need abstract classes?
c) Why we cannot able to create objects of abstract classes give reasonable justification of that.
You have been developing a small commercial Software for numeric operations. You are working on the calculation of areas and volume of different shapes. Based on your software complete these tasks:
a) Create a function template named as shape() that accepts three arguments in such a way that first and second will be the dimension like base and height and the third will be the name of the shape. The shape() function displays the dimension values and the area of the shape. The function returns the area to the calling program; the area is the same data type as the parameter. [Note: Design a main program such that, it input the values of only those shapes whose area is computable on the bases of base and height only]
b) Create another function template named as show_master()that accepts two arguments. The first is index and the second argument is an array of 10 values. The show_master() function will returns the specified index value.
You have been developing a small commercial Software for numeric operations. You are working on the calculation of areas and volume of different shapes. Based on your software complete these tasks:
a) Create a function template named as shape() that accepts three arguments in such a way that first and second will be the dimension like base and height and the third will be the name of the shape. The shape() function displays the dimension values and the area of the shape. The function returns the area to the calling program; the area is the same data type as the parameter. [Note: Design a main program such that, it input the values of only those shapes whose area is computable on the bases of base and height only]
Create another function template named as show_master()that accepts two arguments. The first is index and the second argument is an array of 10 values. The show_master() function will returns the specified index value
use a proper iterative structure to write a programin c++ that will read names and exam scores of students saving them in two different arrays. the class average is to be calculated and printed at the end of the report score can range from 0 to 100. the last record contains a blank name and a score 999 and is not be included in the calculations
write a program is c++ using nested if structure to ask a user about students assigment marks, test marks and exam marks. the program will proceed step by step (it will go to read value of the next assigment component only if the previous assemrny id passed and will display a message for each of the assigment components whether it is fulfilled or not. assume the followig statement ass a passing critera cheeg
Create a class called Transmitter. It has three unsigned int private data members: pay_load,
parity and data_packet; It has one function called parity_bit(). It calculates parity bit by XORing
all pay_load bits and assign the value to parity. By using function get pay_load(), pay_load is got.
data_packet is calculated by multiplying parity_bit with 32768 and add the product with (pay_load
– 32768). Create another class called Receiver. It has unsigned int private data members Rx_Pkt
, Rx_Data and E_Flag. Rx_Data is got from Rx_Data as given below. First E_Flag is calculated
from Rx_Pkt by XORing all bits. If E_Flag is zero, then Rx_Data = Rx_Pkt – 32768, Else a
message should warn about corrupted packet. Derive a class called Tranceiver from the above two
classes and check the functionalities. Use any other functions if needed.
Create a base class called Shape which has two double type values. Use member functions get()
and set() to get and set the values. Use a virtual function display_area() to display the area. Derive
two specific classes called Triangle and Rectangle from the base class Shape. Redefine
display_area() in the derived classes. Write a program to display the rectangle or triangle area.
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.
Define a class Student with data members as rollno and name. Derive a class Fees from student
that has a data member fees and functions to submit fees and generate receipt. Derive another class
Result from Student that displays the marks and grade obtained by the student. Write a program that
extends the class Result so that the final result of the Student is evaluated based on the marks obtained
in tests, activities and sports.