Problem Statement:
You are required develop a BILLING SYSTEM of a virtual restaurant by applying problem solving process (Problem, Abstraction, Analysis, Pseudo code, Flowchart, code and then testing). The basic idea is that by entering the meal price, your billing system will calculate the Sales Tax, Total amount and Complement offer upon that meal. The program will process the billing of undetermined number for customers. At the end, program will show sum of total amount of all the customers.
Detailed Description:
Billing System should work as under:
- After getting this input, program will calculate the sales tax on it as given below:
- After calculating the sales tax, program will calculate and display the total amount of the meal.
- Now, program will prompt to serve the complement sweet dish to customer on the basis of total amount as given below:
After displaying the information of one customer, the program should ask the user if he/she again wants to process the bill of another customer. The user will be given two options. If user selects “Y or y”, the program will start the processing of another customer. If user selects “N or n”, the billing system exits.
Before exiting from billing system, this program should display the total number of customers it processed, and sum of total amount of all the customers.
Output:
Code:
#include<iostream>
#include <conio.h>
using namespace std;
void main()
{
int total_customer = 0;
float total_amount_all = 0;
cout<<"\t\t\t\t*\t*";
cout<<"\t\t\t\t**\t**";
cout<<"\t\t\t\t***\t***";
cout<<"\t\t\t\t****\t****";
cout<<"\t\t\t\t*****\t*****";
cout<<"\t\t\t\t******\t******";
cout<<"\t\t\t\t*******\t*******";
cout<<"\t\t\t\t*******\t*******";
cout<<"\t\t\t\t******\t******";
cout<<"\t\t\t\t*****\t*****";
cout<<"\t\t\t\t****\t****";
cout<<"\t\t\t\t***\t***";
cout<<"\t\t\t\t**\t**";
cout<<"\t\t\t\t*\t*";
cout<<"\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
cout<<"\n\t\t\tWelcome to the Virtual Restaurant";
cout<<"\n\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
for(;;)
{
float meal_price;
float tax = 0;
float final_meal_price;
cout<<"\nPlease Enter the Meal Price: ";
cin>>meal_price;
if(meal_price <= 1000)
{
tax = 0;
}
else if (meal_price > 1000 && meal_price <= 2000)
{
tax = 0.01 * meal_price;
}
else if(meal_price > 2000)
{
tax = 0.02 * meal_price;
}
final_meal_price = tax + meal_price;
total_customer++;
total_amount_all = total_amount_all + final_meal_price;
cout<<"\nTotal: " <<final_meal_price;
if(final_meal_price < 1000)
{
cout<<"\n\t\t Complement Sweet Dish: Candies\n";
}
else if(final_meal_price >= 1000 && final_meal_price < 2000)
{
cout<<"\n \t\tComplement Sweet Dish: Sweet Bread\n";
}
else if(final_meal_price >= 2000 && final_meal_price < 3000)
{
cout<<"\n\t\t Complement Sweet Dish: Pudding\n";
}
else if(final_meal_price >= 3000 && final_meal_price < 4000)
{
cout<<"\n \t\tComplement Sweet Dish: Cake\n";
}
else
{
cout<<"\n \t\tComplement Sweet Dish: Trifle\n";
}
cout<<"\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
char YorN;
cout<<"\n\t\tDo you want to process another bill? (Y for yes or N for no) \n";
cout<<"\n\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
cout<<"\n\t\tOption: ";
cin>>YorN;
if(YorN == 'Y' || YorN == 'y')
{
meal_price = 0;
tax = 0;
final_meal_price = 0;
system("cls");
continue;
}
else if(YorN == 'N' || YorN == 'n')
{
break;
}
}
cout<<"\n\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
cout<<"\t\tTotal Customer: "<<total_customer;
cout<<"\n\t\tTotal Amount for all customer: "<<total_amount_all;
cout<<"\n\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
getch();
}