In: Computer Science
use C++
. Compute the total cost of a meal inclusive of GST (Goods and Service Tax) and tipping. Assume that the GST is fixed at 6% but the amount to tip will depend on the customer. Your program should input the cost of the meal (before GST and tipping) and the tip amount (to be input as a percentage). Your program should display: - The total cost of the meal BEFORE GST and tipping - The total cost of the meal AFTER GST - The total cost of the meal AFTER GST and tipping
main.cpp
#include <iostream>
using namespace std;
int main()
{
double meal_cost, GST=6, tip, total_cost;
cout<<"Enter the cost of the meal: ";
cin>>meal_cost;
cout<<"Enter the tip amount (in percentage): ";
cin>>tip;
cout<<"The total cost of the meal before GST and tipping =
"<<meal_cost<<endl;
//calculating total cost after GST
total_cost = meal_cost + meal_cost*6/100;
cout<<"The total cost of the meal after GST =
"<<total_cost<<endl;
//calculating total cost after GST and tip
total_cost+= meal_cost*tip/100;
cout<<"The total cost of the meal after GST and tipping =
"<<total_cost<<endl;
return 0;
}
Code Snippet (For Indentation):
Output: