- Define a class Taxpayer, whose class description is given below:-
Private Members:-
int pan - to store the personal account no.
char name[20] - to store the name
float taxableinc - to store the total annual taxable income.
float tax - to store the tax that is calculated.
computetax ( )- A function to compute tax from the following rule:-
Total Annual Taxable Income |
Rate of Taxation |
Up to 60000 |
0% |
Greater than 60000, less than = 150000 |
5% |
Above 150000, upto 500000 |
10% |
Above 500000 |
15% |
Public Members :-
inputdata ( ) - A function to enter the data and call the compute tax( ) function.
display( ) - To display the data.
- Write the names of data members which are accessible from objects belonging to class cloth.
- Write the names of all members which are accessible from objects belonging to class design.
- Write the names of all the data members which are accessible from member functions of class costing.
- How many bytes will be required by an object belonging to class design?
- Write a function in C++ which accepts an integer array and its size as arguments / parameters and arrange all the odd numbers in the first row and even numbers in the second row of a two dimensional array as follows. The unused cells of two dimensional array must be filled with 0.
If the array is 1, 2, 3, 4, 5, 6
The resultant 2-D array is given below
1 3 5 0 0 0
0 0 0 6 4 2
- A 2-d array defined as A[4..7, -1..3] requires 2 words of storage space for each element stored in row major order. Calculate the address of A[7,0] and base address if the location of A[6,2] as 126.
- Consider the following portion of a program, which is implemented as linked list of library. Write the definition of function PUSH( ), to insert a new node in the stack and definitions of function POP(), to delete a node from the stack
struct Library
{
int id;
char name[20];
Library *Link;
};
- What is the purpose of seekp() and seekg( )
- Write a function in C++ to read a text file “SPACE.TXT” . Using this file create another file “ OUT.TXT” by replacing more than one space by single space.
Example:
If the file “SPACE .TXT” contains the following
I like ice cream.
The function should create another file OUT.TXT with the text
I like ice cream.
-
Write a function in C++ to transfer a particular type of stock from the file “inventory.dat” to another file “backinvent.dat”. Assuming that the binary file is containing the records of following structure :
struct Products
{
int id;
char Iname[30];
int type;
};
Remember that transfer means deletion from the “inventory.dat” file and addition in the “backinvent.dat” file.