I just finished my Program #3 for my first C++ class and I have a couple of qeustions about it. Our teacher gave us the main coding to this, all we had to do was define the functions of the program to make it run properly. Well, after I have defined the functions and compile and link it, it gives me "warning messages" about changing assignment "int" to "double". Could someone look over my program and please explain to me how to fix this? Also, does anyone have any suggestions on changing anything about this program? The program does what it is suppost to do, but is there anything that should be "fine-tuned". Your help is much appreciated!!!! Thanks, Brent

//This program will takes the input of purchases and returns the total charge with taxes and computes the change.

#include <iostream>

#include <cmath>

using namespace std;

double SumPurchases (void);

// Computes the total purchase price

double ComputeDiscount (double);

// Computes the customer's discount based on their total purchase price

double ComputeTax (double);

// Computes the amount of sales tax on the total after discount

void PrintChange (double, double);

// Displays the change in bills and coins that the cashier should give

// the customer

int main ( )

{

cout.setf(ios::fixed);

cout.setf(ios::showpoint);

cout.precision (2);

double total, discount, tax, grandTotal, payment;

total = SumPurchases ( );

cout << endl << endl << endl;

cout << "The total purchase price is $ " << total << endl;

discount = ComputeDiscount (total);

cout << "Your discount is $ " << discount << endl;

total = total - discount;

cout << "The total less discount is $ " << total << endl;

tax = ComputeTax (total);

cout << "Your tax (at 9%) is " << tax << endl;

grandTotal = total + tax;

cout << "Your total including tax is $ " << grandTotal << endl;

cout << "Amount accepted from customer is : $ ";

cin >> payment;

cout << endl << endl;

PrintChange (grandTotal, payment);

return 0;

}

double SumPurchases (void)// This function recieves the price and the quantity of the items purchased.

{ // and returns the total amount of purchases.

int quantity;

double price, TotalPurchase=0;

while (price > 0 && quantity > 0)

{

cout <<"Enter price of the item and the quantity purchased (0 0 to exit):";

cin >> price >> quantity;

TotalPurchase = TotalPurchase + (price * quantity);

}

return TotalPurchase;

}

double ComputeDiscount(double TotalPurchase)// Function computes the discount rate of the purchase.

{

double discount, RoundedDiscount;

if(TotalPurchase > 500)

discount = TotalPurchase * .10;

else if(TotalPurchase > 250 && TotalPurchase <=500)

discount = TotalPurchase * .05;

else if(TotalPurchase<= 250)

discount = 0;

RoundedDiscount= floor((discount*100)+0.50)/ 100;

return RoundedDiscount;

}

double ComputeTax(double total_amount)// Function returns the amount of the tax to be charged to the customer.

{

double tax, rounded_tax;

tax = total_amount * 0.09;

rounded_tax = floor((tax * 100) + 0.5)/ 100;

return rounded_tax;

}

void PrintChange (double bill, double payment)// This function determines the amount of change, then gives the number

{ // of bills and coins to be give the customer.

double change;

int twenties, tens, fives, ones, quarters, dimes, nickels, pennies;

cout << "Your bill is:$" << bill << endl;

cout << "You paid:$" << payment << endl;

change = payment - bill;

cout << "Your change is:$" << change << endl;

if (change >= 20)

{

twenties = change/20;

change=change-(twenties*20.0);

cout <<"\t"<<twenties <<"\t"<<"20-dollar bills" <<endl;}

else

cout <<"\t"<<"0"<<"\t"<<"20-dollar bills" <<endl;

if (change >= 10 && change < 20)

{

tens= change/10;

change= change-(tens*10.0);

cout <<"\t"<< tens <<"\t"<<"10-dollar bills" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"10-dollar bills" <<endl;

if (change >= 5 && change< 10)

{

fives=change/5;

change=change-(fives*5.0);

cout <<"\t"<< fives <<"\t"<<"5-dollar bills" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"5-dollar bills" <<endl;

if (change>=1 && change < 5)

{

ones=change/1;

change=change-(ones*1.0);

cout <<"\t"<< ones <<"\t"<<"1-dollar bills" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"1-dollar bills" <<endl;

if (change >= .25 && change < 1)

{

quarters=change/0.25;

change=change-(quarters* 0.25);

cout <<"\t"<< quarters <<"\t"<<"quarters" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"quarters" <<endl;

if (change >= .10 && change < .25)

{

dimes=change/.10;

change=change-(dimes*.10);

cout <<"\t"<< dimes <<"\t"<<"dimes" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"dimes" <<endl;

if (change >= .05 && change<.10)

{

nickels=change/.05;

change=change-(nickels*.05);

cout <<"\t"<< nickels<<"\t"<<"nickels" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"nickels" <<endl;

if (change>= .00 && change <.05)

{

pennies=change/.01;

change=change-(pennies*.01);

cout <<"\t"<< pennies <<"\t"<<"pennies" <<endl;

}

else

cout <<"\t"<<"0"<<"\t"<<"pennies" <<endl;

}