Posts

Showing posts from 2020

A food court facilitates their customers with a featured App where the customers can view the Menu Card and place their order. The order may be delivered on-premises or off-premises as per policies. Write a code to take the order from the customer by pressing menu number & Quantity. Final Output should be the calculated total amount.

Image
 A food  court facilitates their customers with a featured App where the customers can view the Menu Card and place their order. The order may be delivered on-premises or off-premises as per policies. Write a code to take the order from the customer by pressing menu number & Quantity. Final Output should be the calculated total amount. Menu card is given as: OUTPUT FOR THE PROGRAM Number Name                                            Price 1               Veg Sandwich                                     80      2               Cheese  Sandwich                              130 3                Veg Grilled  Sandwich                    100 4                  Sada Dosa                                           80 5                  Masala Dosa                                      90 6                  Onion Rava Sada Dosa                  110 7                  Onion Rava Masala Dosa              120 8                  Spring Dosa                                          140 9     

Michael has a beautiful house. There is only one staircase to reach his bedroom. He used to climb either 1 stair or 2 stairs at a time. If we consider all possible combinations of climbing, in how many ways can Michael reach to the top?

Image
Michael has a beautiful house. There is only one staircase to reach his bedroom. He used to climb either 1 stair or 2 stairs at a time. If we consider all possible combinations of climbing, in how many ways can Michael reach to the top? OUTPUT FOR THE PROGRAM #include<iostream> using namespace std; int Stairs,Sum;   int main() {    cout<<"Enter Number of Stairs: ";    cin>>Stairs;    if(Stairs>20)     {     cout<<"Wrong Infrastructure";     }    else     {     if(Stairs%2)     {     Sum=Stairs + (Stairs+1)/2;     cout<<"Total Possible ways are: "<<Sum; } else { Sum=Stairs + (Stairs)/2;     cout<<"Total Possible ways are: "<<Sum; }     } return 0; } /* ****************************Output***************** Enter Number of Stairs: 20 Total Possible ways are: 30 */ For more such posts click the link:- http://svencrai.com/G8W

Create employee bio-data using following classes i) Personal record ii)Professional record iii)Academic record Assume appropriate data members and member function to accept required data & print bio-data. Create bio-data using multiple inheritance using C++.

Image
 Create employee bio-data using following classes i) Personal record ii)Professional record iii)Academic record  Assume appropriate data members and member function to accept required data & print bio-data. Create bio-data using multiple inheritance using C++. OUTPUT OF THE PROGRAM #include<iostream> #include<iomanip> using namespace std; class personal {   protected:           char name[10],add[10],dob[10];           int mob;           char bg[5],gender[6];     public:           void getdata()           {               cout<<"Enter your Name :";               cin>>name;               cout<<"Enter your Current Address :";               cin>>add;               cout<<"Enter your Mobile No. :";               cin>>mob;               cout<<"Enter your Date of Birth :";               cin>>dob;               cout<<"Enter your Blood group :";               cin>>bg;    

Develop an object oriented program in C++ to create a database of student information system containing the following information: Name, Roll number, Class, division, Date of Birth, Blood group, Contact address, telephone number, driving license no. etc Construct the database with suitable member functions for initializing and destroying the data viz constructor, default constructor, Copy constructor, destructor, static member functions, friend class, this pointer, inline code and dynamic memory allocation operators-new and delete.

Image
 Develop an object oriented program in C++ to create a database of student information system containing the following information: Name, Roll number, Class, division, Date of Birth, Blood group, Contact address, telephone number, driving license no. etc Construct the database with suitable member functions for initializing and destroying the data viz constructor, default constructor, Copy constructor, destructor, static member functions, friend class, this pointer, inline code and dynamic memory allocation operators-new and delete. OUTPUT FOR THE PROGRAM #include<iostream> #include<iomanip> #include<cstring> using namespace std; class personal { char bg[5],name[20],dob[10]; char Class[5],div[5]; float height,weight; int ins_pno,roll; char cadd[20]; char ph_no[20]; int dlno; static int cnt; public: friend class derived; personal() { strcpy(name,"Deepika"); roll=24; strcpy(Class,"SE"); strcpy(div,"A");

Write C++ program using STL for implementation of queue using SLL.

Image
 Write C++ program using STL for implementation of queue using SLL. #include<iostream> #include<queue> using namespace std; OUTPUT FOR THE PROGRAM int main() {    int data,i,n;    int ch;     char ans;        queue<int>q;    do    {       cout<<"\nQueue Using STL";       cout<<"\n1.Insert";       cout<<"\n2.Delete";       cout<<"\n3.Size ";       cout<<"\n4.Display Front element";       cout<<"\n5.Dispaly Rear element";       cout<<"\n6.Display All Element";       cout<<"\n\nEnter your choice : ";       cin>>ch;       switch(ch)       { case 1:               if(q.empty())       {                   cout<<"\nHow many elements do you want to insert : ";             cin>>n;           for(i=0;i<n;i++)                   {      cout<<"\nEnter "<<i+1<<" Element :";

Imagine a publishing company which does marketing for book and audiocassette versions. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int), and tape, which adds a playing time in minutes (type float). Write a program that instantiates the book and tape classes, allows user to enter data and displays the data members.

Image
Imagine a publishing company which does marketing for book and audiocassette versions. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int), and tape, which adds a playing time in minutes (type float). Write a program that instantiates the book and tape classes, allows user to enter data and displays the data members. OUTPUT OF THE PROGRAM #include<iostream> using namespace std; class publication {                 char title[10];                float price;        public:             void read()             {                 cout<<"\nEnter Title of the Publication :";                 cin>>title;                 cout<<"\nEnter the price of Publication :";                 cin>>price;             }            void show()             {                 cout<<"Title is :"<<title<<"\n&quo

Write C++ Program with base class convert declares two variables, val1 and val2, which hold the initial and converted values, respectively. It also defines the functions getinit() and getconv(), which return the initial value and the converted value. These elements of convert are fixed and applicable to all derived classes that will inherit convert. However, the function that will actually perform the conversion, compute(), is a pure virtual function that must be defined by the classes derived from convert. The specific nature of compute() will be determined by what type of conversion is taking place.

Image
Write C++ Program with base class convert declares two variables, val1 and val2, which hold the initial and converted values, respectively. It also defines the functions getinit() and getconv(), which return the initial value and the converted value. These elements of convert are fixed and applicable to all derived classes that will inherit convert. However, the function that will actually perform the conversion, compute(), is a pure virtual function that must be defined by the classes derived from convert. The specific nature of compute() will be determined by what type of conversion is taking place. OUTPUT OF THE PROGRAM #include using namespace std; class convert {   protected:         float val1, val2;      public:         float getinit()         {          cout<<"Enter the Initial Value :";          cin>>val1;          return val1;         }         float getconv()         {          return val2;         }         virtual void

Implement a class Complex which represents the Complex Number data type. Implement the following operations: 1. Constructor (including a default constructor which creates the complex number 0+0i). 2. Overloaded operator+ to add two complex numbers. 3. Overloaded operator* to multiply two complex numbers. 4. Overloaded << and >> to print and read Complex Numbers.

Image
Implement a class Complex which represents the Complex Number data type. Implement the following operations: 1. Constructor (including a default constructor which creates the complex number 0+0i). 2. Overloaded operator+ to add two complex numbers. 3. Overloaded operator* to multiply two complex numbers. 4. Overloaded << and >> to print and read Complex Numbers. #include OUTPUT FOR THE PROGRAM using namespace std; class complex {    public:          float real,img;          complex()          {            real = 0;            img = 0;          }                     friend ostream & operator <<(ostream& ,complex& );         friend istream & operator >>(istream& ,complex& );         friend complex operator +(complex &c1,complex&a1);         friend complex operator -(complex &c2,complex&a2);         friend complex operator *(complex &c3,complex&a3);         friend complex operator /(comple

Write a menu driven program that will create a data file containing the list of telephone numbers in the following form John 23456 Ahmed 9876 ……….. ……… Use a class object to store each set of data, access the file created and implement the following tasks I. Determine the telephone number of specified person II. Determine the name if telephone number is known III. Update the telephone number, whenever there is a change.

Image
Write a menu driven program that will create a data file containing the list of telephone numbers in the following form John 23456 Ahmed 9876 …… Use a class object to store each set of data, access the file created and implement the following tasks. I. Determine the telephone number of specified person II. Determine the name if telephone number is known III. Update the telephone number, whenever there is a change. include #include #include OUTPUT FOR THE PROGRAM #include using namespace std; class person {    public:     char name[10];     int phno;         void input_data()     {       cout<<"\n Enter Name:-";       cin>>name;       cout<<"\n Enter Phone no:-";       cin>>phno;         }         void put_data()     {       cout<         }  }; int main() {     person rec;     int phone,pos,choice,offset,i;     fstream fp;     ifstream in;     ofstream out;     c