CODING
#include <iostream>
#include<iomanip>
using namespace std;
void platformType ();
double food ();
double drink ();
void foodDelivery (double, double); //Function prototype (declaration)
// The main method
int main ()
{
int num;
double foodPrice, drinkPrice;
double foodTotal, drinkTotal;
platformType (); // call the function
cin >> num;
cout << "\n**********Data Collection**********"<< endl;
foodTotal = food ();
drinkTotal = drink ();
cout << "\n***** Food Delivery Price Calculator *****" << endl;
cout << "Food Price RM: "<<fixed<<setprecision(2)<< foodTotal << endl;// accuracy to 2
3
, decimal places
cout << "Drink Price RM: "<<fixed<<setprecision(1)<< drinkTotal << endl; // accuracy to
1 decimal places
cout << "Platform : " << num << endl;
if (num == 1)
{
foodPrice = foodTotal * 1.90;
drinkPrice = drinkTotal * 1.90;
}
else if (num == 2)
{
foodPrice = foodTotal * 2.20;
drinkPrice = drinkTotal * 2.20;
}
else if (num == 3)
{
foodPrice = foodTotal * 2.50;
drinkPrice = drinkTotal * 2.50;
}
else if (num == 4)
{
foodPrice = foodTotal * 2.80;
drinkPrice = drinkTotal * 2.80;
}
else if (num == 5)
{
foodPrice = foodTotal * 3.00;
drinkPrice = drinkTotal * 3.00;
}
else if (num == 6)
{
foodPrice = foodTotal * 3.20;
4
#include <iostream>
#include<iomanip>
using namespace std;
void platformType ();
double food ();
double drink ();
void foodDelivery (double, double); //Function prototype (declaration)
// The main method
int main ()
{
int num;
double foodPrice, drinkPrice;
double foodTotal, drinkTotal;
platformType (); // call the function
cin >> num;
cout << "\n**********Data Collection**********"<< endl;
foodTotal = food ();
drinkTotal = drink ();
cout << "\n***** Food Delivery Price Calculator *****" << endl;
cout << "Food Price RM: "<<fixed<<setprecision(2)<< foodTotal << endl;// accuracy to 2
3
, decimal places
cout << "Drink Price RM: "<<fixed<<setprecision(1)<< drinkTotal << endl; // accuracy to
1 decimal places
cout << "Platform : " << num << endl;
if (num == 1)
{
foodPrice = foodTotal * 1.90;
drinkPrice = drinkTotal * 1.90;
}
else if (num == 2)
{
foodPrice = foodTotal * 2.20;
drinkPrice = drinkTotal * 2.20;
}
else if (num == 3)
{
foodPrice = foodTotal * 2.50;
drinkPrice = drinkTotal * 2.50;
}
else if (num == 4)
{
foodPrice = foodTotal * 2.80;
drinkPrice = drinkTotal * 2.80;
}
else if (num == 5)
{
foodPrice = foodTotal * 3.00;
drinkPrice = drinkTotal * 3.00;
}
else if (num == 6)
{
foodPrice = foodTotal * 3.20;
4