Q1. Define a class Deposit that has a principal, a rate of interest, which is fixed for all
deposits and a period in terms of years. Write member functions to
(i) alter(float) which can change the rate of interest.
(ii) interest() which computes the interest and returns it.
(iii) print() which prints data as shown below. Note that the width of each column is 20.
5mks
Q2. Assume that the cell users are two kinds – those with a postpaid option and those
with a prepaid option. Postpaid gives a fixed free talk time and the rest is computed at
the rate of N2.90 per pulse. Prepaid cards have a fixed talk time.
Define a class Cell_user as a base class and derive the hierarchy of classes. Define
member functions and override them wherever necessary to
(i) retrieve the talk time left for each user.
(ii) print the bill in a proper format containing all the information for the postpaid user.
5mks
#include <stdio.h>
int main()
{ float principle, rate, sinterest; int time;
printf("Enter Principle Amount, Rate %% per Annum and Time\n");
scanf ("%f %f %d", &principle, &rate, &time);
Comments
Leave a comment