Subject Code: Name: Aditya Kumar Panda Section: D2010 Regd. No.: 12013730 Rollnumber: Rd2010B85
Subject Code: Name: Aditya Kumar Panda Section: D2010 Regd. No.: 12013730 Rollnumber: Rd2010B85
Code: CAP:445
Name: Aditya Kumar Panda
Section: D2010
RollNumber: RD2010B85
Q1. Write a program for shopping mall, in shopping mall, there is an LED shop, User is given various offers on the
purchase of LED if you will purchase LED with television connection you will get 10% discount, but if you
purchase any LED you will get only 5 % discount. Display this offer to the user screen whenever user is
selecting the option. Also generate the final user bill after purchase with actual amount, discount and billing
amount.Select option:
1. Only LED
3. Normal television
#include<iostream>
#include<string>
using namespace std;
};
int display(int ch) //to display the product list and select the product
{
int i;
cout<<"====================================================="<<endl;
cout<<"Item No"<<"\t\t"<<"Name"<<"\t\t\t"<<"Price"<<endl;
cout<<"====================================================="<<endl;
for(i=0;i<6;i++)
{
if(ch==category[i])
{
cout<<itemno[i]<<"\t\t"<<name[i]<<"\t"<<price[i]<<endl;
}
void calculate(int product_no, int x) //To calculate the product price and discount
{
for(int i=0;i<6;i++)
{
if(itemno[i]==product_no)//to select the product from the product list
{
discount_percent=x;
item_name=name[i];
item_price=price[i];
discounted_price=price[i]*discount_percent/100;
total_price=item_price-discounted_price;
}
}
}
void showbill() //to show the bill
{
cout<<"--------------------------------\n";
cout<<"item no: "<<product_no<<endl;
cout<<"Item Name: "<<item_name<<endl;
cout<<"Actual Price: "<<item_price<<endl;
cout<<"Discount: "<<discount_percent<<"%"<<endl;
cout<<"Total Price: "<<total_price<<endl;
}
};
int main()
{
discount dis;
int choice,exit,product_no;
cout<<"\n\n\tWelcome to the Aditya LED Shop \n"<<endl;
cout<<"******************************************************\n";
cout<<"At the time we have offer "<<endl;
cout<<"-> If you have buy LED TV with Dish Connection get FLAT 10% Discount"<<endl;
cout<<"-> And if you buy Only LED TV you get FLAT 5% Discount\n";
cout<<"******************************************************\n\n";
do
{
exit=0;
cout<<"Select any of the product category\n";
cout<<" 1. Only LED\n 2. LED and dish connection \n 3. Normal television\n";
cout<<"\nEnter your choice(1-3): ";
cin>>choice;
if(choice==1)
{
product_no=dis.display(1); //display the Only LED product list
dis.calculate(product_no,15);
dis.showbill();
}
else if(choice==2)
{
product_no=dis.display(2); //display the LED and dish connection product list
dis.calculate(product_no,10);
dis.showbill();
}
else if(choice==3)
{
product_no=dis.display(3); //display the Normal Television product list
dis.calculate(product_no,0);
dis.showbill();
}
else
{
cout<<"Please enter the correct choice(1-3)";
exit=1;
}
}
while(exit==1); //To check the invalid input
return 0;
}
Output:-
Q2. A person having account in a bank. His balance in bank account is 50000. He is also getting 2000 Rs.
from PM Fund every month and 5% of interest on the amount saved quarterly. Create one application
where you have applied the concept of multiple inheritance which will display extra amount he is getting
annually?
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
public:
double input_balance()
{
cout<<"Enter the balnce available at the time: ";
cin>>p;
}
double calc_balance()
{
a=p*pow((1+rate/quater),quater);
return a-p;
}
};
total_interest=monthly_interest+balance_interest;
}
void show() //to show the total interest
{
cout<<"You total interest annually get: "<<total_interest;
}
};
int main()
{
bank aditya;
aditya.calc();
aditya.show();
}
Output:
Q3 Write a program to overload copy constructor and parameterized constructor with default arguments.
Implement the concept of finding a number is Armstrong in the same program.
#include<iostream>
using namespace std;
int r;
while (temp > 0)
{
r = temp % 10;
num = num + r * r* r;
temp = temp/10;
}
}
};
int main()
{
int x;
cout << "Enter a number: ";
cin>>x;
if(a.num==b.num)
cout<<"Number is armstrong: "<<a.num;
else
cout<<"Number is not armstrong: "<<a.num;
return 0;
}
Output: