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.
Write a C++ code to read a line of string as an input and do the following operations. Do proper input validation to your input.
i) Capitalize first and last character of each word in the given string. [3 Marks]
ii) Delete a word from the given string. Popup a message if the string is empty. [5 Marks]
iii) Add a word in the middle of the given string. Capitalize the new word if it already exists.
iv) For proper input validation
Dry run the following code and draw the tree to show how recursion is solved. On writing only
output you will get zero number.
int fun(int a, int b)
{
if (b == 0)
return 0;
if (b % 2 == 0)
return fun(a + a, b/2);
return fun(a + a, b/2) + a;
}
int main()
{
cout << fun(4, 3) ;
return 0;
}
Dry run the following code and draw the tree to show how recursion is solved. On writing only
output you will get zero number.
a) fun1(5)
void fun1(int n)
{
int i = 0;
if (n > 1)
fun1(n - 1);
for (i = 0; i < n; i++)
cout << " * ";
}
Find the minimum and maximum element in doubly linked list using recursion.
Write a recursive function to Reverse the singly linked list and return the head of list.
For Example: head→1→5→6 →8→NULL, after function linked list will become
head→8→6→5→1→NULL
Print the doubly linked list in recursive order.
The kill monger game c++ code
Craete a class city which have data for average temperature accept data from the user for 5 different cities and display the information on screen
FRIDAY THE 13TH
When will Friday the 13th occur in 1990? Write a program that will
find all months in 1990 in which the 13th falls on a Friday.
You need to know the following.
1. January 1, 1990 was on a Monday.
2. September, April, June, and November have thirty days, all the rest
have 31 except for February which has 28 except in leap years when it has 29.
3. 1990 is not a leap year.
Note: To make it fair for everyone, you may not use any built-in date
functions from your computer language.
Sample Run
In 1990, Friday the 13th occurs in the months:
APRIL