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.

Wednesday 23 March 2016

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();
}
};

9 comments:

  1. The error that is showing in the problem "cost of pizza"is Segmentation fault (core dumped)

    ReplyDelete
  2. Please make sure you have copied correctly.
    If error persists,kindly email me the screenshot of the input,expected output and output.
    I will look into it at once.

    ReplyDelete
  3. Sir, code is not present on the blog now, instead its showing advertisement.Please rectify.

    ReplyDelete
    Replies
    1. There were some issues.
      They have been taken care of.
      It should be visible now.

      Delete
    2. Thank you sir. You are doing great job in helping us, especially mechanical :)

      Delete
  4. format the answer to 2 decimal places

    ReplyDelete
  5. Corrected.Please try again.

    ReplyDelete
  6. its woking ok!!!!! you posted even the previous code...

    ReplyDelete