- #include "franca.h"
//c3sale2.cpp
- // Program to implement a point of sale
terminal
- //
- // gets tax information
- // Reads item prices
- // totals each sale
- // computes change
- //
- // keeps daily total
- float getitem(Box display)
- {
- float total=0;
- for(int item=1;yesno("another
item?");item++)
- {
- total=total+ask("Enter item
price:");
- display.say(total);
- }
- return total;
- }
- void mainprog()
- {
- Box Cur_total("Current
total");
- Box Saletotal("Total
Sale:"),Amount("Tendered:");
- Box Change("Change due:");
- float
tax,amount,price,saletotal,dailytotal,change;
- dailytotal=0;
- tax=ask("Enter the sale tax
%")/100.;
- for (int customer=1;yesno("Is there
another customer?");customer++)
- {
- // start a sale
- saletotal=0;
- amount=0;
- change=0;
-
Saletotal.say(saletotal);
- Amount.say(amount);
- Change.say(change);
-
saletotal=getitem(Cur_total)*(1+tax);
-
Saletotal.say(saletotal);
- amount=ask("Enter amount
tendered:");
- Amount.say(amount);
-
change=amount-saletotal;
- Change.say(change);
- }
- }