TAB

One of the works done by our Robotics and Machine Learning division,
SELF-LEVELING QUADCOPTER
Arduino based Quadcopter.
Self-leveling is acheived by the aligning the quadcopter using the readings from the gryo as well as the accelerometer.
A four channel RC transmitter is used to control the movement of the quadcopter when in flight. Kindly subscribe to our YouTube Channel and stay tuned.

Thursday, 14 April 2016

PRACTICE PROBLEM 6

I realize you will have problems given that you do not have the code now on.I would like to encourage all of you to try code the solution on your own.

PLEASE LEAVE THE PROBLEMS THAT YOU FACE IN THE COMMENTS. I WILL TRY TO HELP YOU OUT.


1.MATRIX:
->user defined exception class called mismatchDimension which contains a function "error_Msg()" to print the error message
->define get function to take the inputs(i.e. row,col,element array)
->define check_Sparse to count the number of zeroes in the matrix and return value accordingly.
->define add function that adds content of two matrices,provided their dimensions are similar.
2.AC_BINARY TREE
->define leftChild and rightChild functions to return the 2*i+1 th and 2*i +2th elements.
->define isFull and is Empty to check for the corresponding conditions no_Of_Ele==capacity and no_Of_Ele==0
3.STUDENT GRADING
->It is to be solved using userdefined exception classes (negException and moreException)
->compute average and allot grade using else if ladder.
->call all the functions in the try block and catch the objects to display the corresponding exception.
4.COUNT
->It is to be solved using userdefined exception classes (negException and moreException)
->compute average and allot grade using else if ladder.
->call all the functions in the try block and catch the objects to display the corresponding exception.
5.GENERIC BOX
->It is to be solved using userdefined exception classes (negException and moreException)
->compute average and allot grade using else if ladder.
->call all the functions in the try block and catch the objects to display the corresponding exception.

IMPORTANT NOTICE

There will be a drastic change in the type of posts on this blog from now onwards.
I will only be giving explanation of the questions and the procedure to tackle the problem.

Wednesday, 23 March 2016

PRACTICE PROBLEM 5 : COINS

====================================

=======================================
void coin::get()
{
cin>>weight;
cin>>curr_X;
cin>>curr_Y;
}
void coin::print()
{
cout<<weight<<endl;
}
int coin::get_Curr_X()
{
return curr_X;
}
int coin::get_Curr_Y()
{
return curr_Y;
}
int coin::get_Weight()
{
return weight;
}
class black_Coin:public coin
{
int moves;
public:
void get()
{
coin::get();
cin>>moves;
}
void print()
{
coin::print();
}
void move()
{
cout<<curr_X<<","<<curr_Y+1;
}
int gained_Power()
{
if(moves>=5)
return 1;
else
return 0;
}


};
class red_Coin:public coin
{
public:
void get()
{
coin::get();
}
void print()
{
coin::print();
}
void move()
{
cout<<curr_X-1<<","<<curr_Y<<endl;
cout<<curr_X+1<<","<<curr_Y<<endl;
cout<<curr_X<<","<<curr_Y-1<<endl;
cout<<curr_X<<","<<curr_Y+1<<endl;
cout<<curr_X-1<<","<<curr_Y-1<<endl;
cout<<curr_X+1<<","<<curr_Y-1<<endl;
cout<<curr_X-1<<","<<curr_Y+1<<endl;
cout<<curr_X+1<<","<<curr_Y+1<<endl;
}
void set_Curr_Pos_Wt(black_Coin b)
{
weight=b.get_Weight();
curr_X=b.get_Curr_X();
curr_Y=b.get_Curr_Y();
}



};

PRACTICE PROBLEM 5 : PIZZA

void circle::get_C()
{
cin>>radius;
}
void circle::print_C()
{
cout<<radius;
}
float circle::area()
{
return 3.14*radius*radius;
}
void kitchen::get_K()
{
cin>>num1;
int i;
for(i=0;i<num1;i++)
{
cin>>ing_Cost[i].name;
cin>>ing_Cost[i].price;
}
}
void kitchen::print_K()
{
cout<<num1;
int i;
for(i=0;i<num1;i++)
{
cout<<ing_Cost[i].name;
cout<<ing_Cost[i].price;
}
}
float kitchen::get_Cost(char a[])
{
int i;
for(i=0;i<num1;i++)
{
if(strcmp(ing_Cost[i].name,a)==0)
return ing_Cost[i].price;
}
}
void cookeditem::get_CI()
{
cin>>num;
int i;
for(i=0;i<num;i++)
{
cin>>ing_Qty[i].name;
cin>>ing_Qty[i].qty;
}
}
void cookeditem::print_CI()
{
cout<<num;
int i;
for(i=0;i<num;i++)
{
cout<<ing_Qty[i].name;
cout<<ing_Qty[i].qty;
}
}
class pizza:public circle,public cookeditem
{
protected:
float cost;
public:
void get_P()
{
circle::get_C();
cookeditem::get_CI();
}
void compute_Cost(kitchen k)
{
int i;
for(i=0;i<num;i++)
{
cost+=(ing_Qty[i].qty/100)*k.get_Cost(ing_Qty[i].name);
}
cost=cost*circle::area();
}
void print_P()
{
cout<<fixed<<setprecision(2)<<cost;
}
pizza()
{
cost=0.0;
}
};
class veg_Pizza:public pizza
{
public:
void get_P()
{
pizza::get_P();
}
void compute_Cost(kitchen k)
{
pizza::compute_Cost(k);
cost+=50;
}
void print_P()
{
pizza::print_P();
}
veg_Pizza()
{
pizza();
}
};
class chik_Pizza:public pizza
{
public:
void get_P()
{
pizza::get_P();
}
void compute_Cost(kitchen k)
{
pizza::compute_Cost(k);
cost+=100;
}
void print_P()
{
pizza::print_P();
}
chik_Pizza()
{
pizza();
}
};

PRACTICE PROBLEM 5 :College Application

==================================================================


====================================================================
#include<iostream>
#include<iomanip>
using namespace std;
class Application
{
protected:
string name;
int age;
int Eng;
int SL;
int id;
int M;
int P;
int C;
int CS;
float cutoff;
public:
void get()
{
cin>>id;
cin>>name;
cin>>age;
cin>>Eng;
cin>>SL;
cin>>M;
cin>>P;
cin>>C;
cin>>CS;
}
void print()
{
cout<<name<<endl;
cout<<fixed<<setprecision(2)<<cutoff;
}
};
class engg_Appln:public Application
{
int E;
public:
void get()
{
Application::get();
cin>>E;
}
void calc_Cutoff()
{
Application::cutoff=(M+P+C)/3.0+E;
}
void print()
{
Application::print();
}
};
class arts_Appln:public Application
{
public:
void get()
{
Application::get();
}
void calc_Cutoff()
{
Application::cutoff=(Eng+M+P+C+SL+CS)/6.0;
}
void print()
{
Application::print();
}
};

PRACTICE PROBLEM 5: Price of book and CD/DVD

====================================

====================================
void learning_Material::get()
{
cin>>isbn;
cin>>title;
cin>>author;
cin>>year;
}
void learning_Material::print()
{
cout<<isbn<<endl;
cout<<title<<endl;
cout<<price;
}
class book:public learning_Material
{
int pages;
public:
void get()
{
learning_Material::get();
cin>>pages;
}
void print()
{
learning_Material::print();
}
void calc_Price()
{
price=pages;
}
};
class CD:public learning_Material
{
int min;
public:
void get()
{
learning_Material::get();
cin>>min;
}
void print()
{
learning_Material::print();
}
void calc_Price()
{
price=min*2;
}
};

PRACTICE PROBLEM 5 : Customer Discount

=====================================
=====================================
#include<iostream>
using namespace std;
class customer
{
string name;
string no;
string adr;
string id;
int n;
int p[100];
public:
void get()
{
cin>>name;
cin>>no;
cin>>adr;
cin>>id;
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>p[i];
}
int calc_Total()
{
int sum,i;
for(i=0;i<n;i++)
sum=sum+p[i];
return sum;
}


};
class preferred_Customer
{
string name;
string no;
string adr;
string id;
int n;
int p[100];
public:
void get()
{
cin>>name;
cin>>no;
cin>>adr;
cin>>id;
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>p[i];
}
int calc_Total()
{
int sum,i;
for(i=0;i<n;i++)
{sum=sum+p[i];
if(sum>=5000 && sum<10000)
sum=sum-p[i]/100;
else if(sum>=10000 && sum<15000)
sum=sum-p[i]/50;
else if(sum>=15000 && sum<20000)
sum=sum-p[i]*3/100;
else if(sum>=20000)
sum=sum-p[i]/25;
}
return sum;
}
};

Friday, 11 March 2016

PRACTICE PROBLEM 4 :overload polynomial


AT LAST IT WORKED!!!!!
-------------------------------------------------------------------------------------------------------------------------------

 This program is really complex!

================================================= 

================================================
poly::poly()
{
    num=0;
    terms=new term[10];
}
poly::poly(int a)
{
    num=a;
    terms=new term[10];
}
poly::poly(poly &p)
{
    num=p.num;
    terms=new term[10];
}
poly poly::operator+(poly& p)
{
    poly temp;
    int i,j,k=0;
    int done =0;
    term *point,*p2,*p3;
    p2=p.terms;
    p3=terms;
    point=temp.terms;

    while(done!=1)
    {
        if((p.terms)->expo>terms->expo)
        {
            temp.terms->expo=p.terms->expo;
            temp.terms->coeff=p.terms->coeff;
            p.terms++;

        }

        else if((p.terms)->expo<terms->expo)
        {
            temp.terms->expo=terms->expo;
            temp.terms->coeff=terms->coeff;
            terms++;

        }
        else
        {
            temp.terms->expo=terms->expo;
            temp.terms->coeff=p.terms->coeff+terms->coeff;
            p.terms++;
            terms++;
        }
    if(p.terms->coeff==0 && p.terms->expo==0)
    {
    if(terms->coeff==0 && terms->expo==0)
    {
    done=1;
    }
    }
        (temp.terms)++;
        k++;
    }
    temp.num=k;
    temp.terms->coeff=0;
    temp.terms->expo=0;
    temp.terms=point;
    p.terms=p2;
    terms=p3;
    return temp;
}
poly poly::operator++()
{
    poly temp;
    term *point,*p2,*p3;
    int d=0;
    point=temp.terms;
    p2=terms;
    temp.terms->coeff=terms->coeff+1;
    temp.terms->expo=terms->expo+1;
    d++;
    temp.terms++;
    while(terms->coeff!=0 || terms->expo!=0)
    {
        temp.terms->coeff=terms->coeff;
        temp.terms->expo=terms->expo;
        temp.terms++;
        d++;
        terms++;
    }
    temp.num=d;
    temp.terms->coeff=0;
    temp.terms->expo=0;
    temp.terms=point;
    terms=p2;

    return temp;
}
poly poly::operator++(int a)
{
    poly temp;
    term *point,*p2,*p3;
    int d=0;
    point=temp.terms;
    p2=terms;
    temp.terms->coeff=terms->coeff+1;
    temp.terms->expo=terms->expo+1;
    d++;
    temp.terms++;
    while(terms->coeff!=0 || terms->expo!=0)
    {
        temp.terms->coeff=terms->coeff;
        temp.terms->expo=terms->expo;
        temp.terms++;
        d++;
        terms++;
    }
    temp.num=d;
    temp.terms->coeff=0;
    temp.terms->expo=0;
    temp.terms=point;
    terms=p2;

    *this=temp;
}
poly& poly::operator=(const poly& p)
{
    num=p.num;
    terms=p.terms;
}
istream& operator>>(istream& b,term& t)
{

    b>>t.coeff>>t.expo;
    return b;
    }
ostream& operator<<(ostream& a,term& t)
{
    a<<t.coeff<<endl<<t.expo<<endl;
    return a;
}
istream& operator>>(istream& a,poly& p)
{
    a>>p.num;
    term *point;
    point=p.terms;
    for(int i=0;i<p.num;i++)
    {
    a>>*(p.terms);
    (p.terms)++;
    }
    p.terms=point;


    return a;
    }
ostream& operator<<(ostream& a,poly& p)
{
    term *point;
    point=p.terms;
    for(int i=0;i<p.num;i++)
    {
    a<<*(p.terms);
    (p.terms)++;
    }
    p.terms=point;
    return a;
}