I am a newbie so please forgive my ignorance. I need help with this program, it is outputting 1s for the functions. I know it's something simple, but like I said I am new and don't know what to do.
#include <iostream>
#include <cctype>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
//constants
const double M = 4.99;
const double L = 7.99;
const double TOPPINGS = .85;
const double DISCOUNT = .90;
const double DELIVER_RATE = .12;
const double ZERO = 0.00;
//functions used
double perPizza(char sizeOfPizza, int numberOfToppings);
double councilDiscount(string studentDiscount, double numberOfPizzas);
double pizzaSubtotal(double amountStudentDiscount, double totalPriceOfPizza);
double billTotal(double amountOfDelivery, double subtotalOfPizza);
double deliveryCharges(bool deliver, double subtotalOfPizza);
double pizzaTotal(double pricePerPizza, double numberOfPizzas);
int main ()
{
//variables
char sizeOfPizza;
double numberOfPizzas;
double numberOfToppings;
string studentDiscount;
bool deliver;
double pricePerPizza;
double amountStudentDiscount;
double totalPriceOfPizza;
double subtotalOfPizza;
double amountOfDelivery;
double totalOfBill;
cout << "Pizza Bill Calculation Program" << endl << endl;
cout << "Size of Pizza, medium or large (M/L): ";
cin >> sizeOfPizza; //get size of pizza from user
cout << "Enter the number of pizzas ordered: ";
cin >> numberOfPizzas; //get number of pizzas from user
cout << "Enter the number of toppings: ";
cin >> numberOfToppings; //get number of toppings from user
cout << "Student Council Member (yes or no - all lowercase): ";
cin >> studentDiscount; //get student council member, yes or no
cout << "Pickup or Delivery (P or D): ";
cin >> deliver; //get choice of delivery or pickup
cout << endl;
cout << "Order Details" << endl << endl;
cout << "Size of Pizzas: ";
cout << setw(27) << fixed << right << setprecision(2);
sizeOfPizza = toupper(sizeOfPizza);
if(sizeOfPizza=='M')
{
cout << "Medium" << endl;
}
if(sizeOfPizza=='L')
{
cout << "Large" << endl;
}
cout << "Number of Toppings: ";
cout << setw(23) << fixed << right << setprecision(0) << numberOfToppings << endl;
cout << "Price per Pizza: ";
cout << setw(26) << fixed << right << setprecision(2) << perPizza << endl;
cout << "Number of Pizzas Ordered: ";
cout << setw(17) << fixed << right << setprecision(0) << numberOfPizzas << endl << endl;
cout << "PIZZA BILL" << endl << endl;
cout << "Pizza Total: ";
cout << setw(30) << fixed << setprecision(2) << pizzaTotal << endl;
cout << "Student Council Discount: ";
cout << setw(17) << fixed << setprecision(2) << councilDiscount << endl;
cout << "Subtotal of Pizza Order: ";
cout << setw(18) << fixed << setprecision(2) << pizzaSubtotal << endl;
cout << "Delivery Charges: ";
cout << setw(25) << fixed << setprecision(2) << deliveryCharges << endl;
cout << "Bill Total: ";
cout << setw(31) << fixed << setprecision(2) << billTotal << endl;
return 0;
}
double perPizza(char sizeOfPizza, int numberOfToppings)
{
double pricePerPizza;
if(sizeOfPizza=='M')
{
pricePerPizza = TOPPINGS * numberOfToppings + M;
}
if(sizeOfPizza=='L')
{
pricePerPizza = TOPPINGS * numberOfToppings + L;
}
return pricePerPizza;
}
double councilDiscount(string studentDiscount, double numberOfPizzas)
{
double amountStudentDiscount;
if(studentDiscount=="yes")
{
amountStudentDiscount = numberOfPizzas * DISCOUNT;
}
if(studentDiscount=="no")
{
amountStudentDiscount = ZERO;
}
return amountStudentDiscount;
}
double pizzaTotal(double pricePerPizza, double numberOfPizzas)
{
double totalPriceOfPizza;
totalPriceOfPizza = pricePerPizza * numberOfPizzas;
cout << endl;
return totalPriceOfPizza;
}
double pizzaSubtotal(double amountStudentDiscount, double totalPriceOfPizza)
{
double subtotalOfPizza;
subtotalOfPizza = totalPriceOfPizza - amountStudentDiscount;
cout << endl;
return subtotalOfPizza;
}
double deliveryCharges(bool deliver, double subtotalOfPizza)
{
double amountOfDelivery;
if(deliver == 'D' || 'd')
{
amountOfDelivery = subtotalOfPizza * DELIVER_RATE;
}
else
{
ZERO;
}
return amountOfDelivery;
}
double billTotal(double amountOfDelivery, double subtotalOfPizza)
{
double totalOfBill;
totalOfBill = amountOfDelivery + subtotalOfPizza;
cout << endl;
return totalOfBill;
system ("PAUSE");
}