Viewing code of RPRestaurantBilling
// ------ ../cgi-bin/cout/RPRestaurantBilling.CPP --------------
//--- Programmed By Rajesh -----

/*

Simulating a Cash Register (3-1) (45 points)
The C-Side Restaurant wants you to write a program that simulates a simple cash register. The program should ask the user to enter price of the meal. The program should calculate the sales tax (8.25% of the meal price) and add it to the price to obtain the total price, which it should display for the user. The program is then to ask for the amount tendered, that is, the amount the customer gives to pay the bill. After the user enters the amount tendered, the program should display the amount tendered, the total price of the meal and the change.

A sample of the output is:

***** C-Side Restaurant *****

Enter the price of the meal: $52.95

Price of Meal: $ 52.95
Sales Tax $ 4.37
Total Amount $ 57.32

Enter amount tendered: $70.00

Amount Tendered: $ 70.00
Total Amount $ 57.32
Change $ 12.69

***** Thank You *****



*/


/* Compiled under Windows XP XP2SP2
Turbo C++ compiler
*/
#include<stdio.h>
#include<conio.h> /* remove if you donot use clrscr() and if you are compiling under linux*/
void main(){
float meal_price;
float cash;
float sales_tax_rate = 0.0825; /* 8.25 % = 8.825/100 = 0.0825 */
float sales_tax;
float total_amount;
float amount_tendered;
clrscr(); /* just incase you want to remove previous junk messages */
printf("\t\t**** C-side Restaurant\n");
printf("Enter the price of meal:$");
scanf("%f",&meal_price);
sales_tax = meal_price*sales_tax_rate;
printf("\n\nSales Tax $ %f \n\n",sales_tax);
printf("\nAmount tendered :");
scanf("%f",&amount_tendered);
total_amount = meal_price+sales_tax; /* total amount = sum of tax + price of meal*/
if(amount_tendered <total_amount) /* warn in case customer provides less amount of money.*/
printf("\n Amount tendered is less than the total amount. ");
printf("\nTotal Amount :$ %f ",total_amount);
printf("\nChange $ %f",(amount_tendered -total_amount));
printf("\n \t\t Thank you ");

}