I have to create a program for a Jewerly Store, that is a markup application that accepts the name of an item (string), the quantity, and the wholesale cost. The markup is based on the name of the item. The program needs to output a welcome statement, accept an unknown number of items, quantities and costs. The sentinel value is a literal string equal to "Done" followed by the two values 0 and 0. The main function will contain a sentinel value loop. The data will be read in by a file. Inside the sentinel value lopp each line of data will be processed. It has to have 5 functions called displayWelcome, correctCost, getMarkUp, calculateRetailPrice, and displayResults.

The problem is I keep getting an error I don't understand. It says: Undefined first refernece symbol in file calculateRetailPrice (int, double, double, double&, double&, double&)/var/tmp/cc7coVgh.o
ld: fatal: Symbol referncing error. No output written to a.out
collect2: ld returned 1 exit status

Can anyone help explain what I am doing wrong and how the error?

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

// Declaring prototypes

void displayWelcome();
double correctCost(double);
double getMarkUp(string);
void calculateRetailPrice(int, double, double, double &, double &,
double &);
void displayResults(string, int, double, double, double, double, double);

int main ()
{
     // Declaring variables
     int quantity = 0;
     double wholeSaleCost = 0, percMarkUp = 0;
     double amountMarkUp= 0, salesTax = 0, retailPrice = 0;
     string item;

     displayWelcome();

     cin >> item;
     cin >> quantity;
     cin >> wholeSaleCost;

     cout << "\n" <<endl;
     cout << "Item Name Quantity      ";
     cout << setw(15) << "Unit Price";
     cout << setw(15) << "Markup %";
     cout << setw(15) << "Markup";
     cout << setw(12) << "Tax";
     cout << setw(20) << "Retail Price";
     cout << endl;

     // Loop with Sentinel value

     while(item != "Done" && quantity != 0 && wholeSaleCost != 0)
     {
          // Less than 1000 test

          if (wholeSaleCost > 1000)
          {
               wholeSaleCost = correctCost(wholeSaleCost);
          }

          percMarkUp = getMarkUp(item);

          calculateRetailPrice(quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          displayResults(item, quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          cin >> item;
          cin >> quantity;
          cin >> wholeSaleCost;
     }
     return 0;
}



void displayWelcome ()
{
     cout << "*****************************************************************"<<e$
     cout <<"* Welcome to ABX. I am Alete, your manager. *" <<endl;
     cout <<"* Here is a summary of your purchases. *" <<endl;
     cout << "****************************************************************"<<en$
}
double correctCost (double wholeSaleCost)
{
     return wholeSaleCost / 100;
}
double getMarkUp(string item)
{
     double percent;
     if (item == "Bracelet" || item == "Earrings")
     percent = 1;
     else if (item == "Necklace")
     percent = .3;
     else if (item == "ToeRing")
     percent = .05;
     else if (item == "KeyFob")
     percent = .25;
     else if (item == "Cufflink")
     percent = .5;

     return percent;
}
void calculateRetailprice(int quantity, double wholeSaleCost, double
percMarkUp, double &amountMarkUp, double &salesTax, double &retailPrice)
{
     double subTotal;
     amountMarkUp = wholeSaleCost * percMarkUp;
     subTotal = (wholeSaleCost + amountMarkUp) * quantity;
     salesTax = subTotal * .06;
     retailPrice = salesTax + subTotal;
}
void displayResults(string item, int quantity, double wholeSaleCost,
double percMarkUp, double amountMarkUp, double salesTax, double
retailPrice)
{
     percMarkUp = percMarkUp * 100;

     cout << setprecision(2) <<fixed;
     cout << left << setw(10) << item;
     cout << "   " << left <<  setw(3) << quantity << "                 ";
     cout << "$" << left << setw(10) << wholeSaleCost;
     cout << right << setprecision(0) << fixed << setw(8) <<percMarkUp <<
"%";
     cout << setprecision(2) << fixed;

     cout << "             $" << left << setw(14) << amountMarkUp;
     cout << "$" << left << setw(11) << salesTax;
     cout << "$" << left << setw(15) << retailPrice <<endl;
}

You define calculateRetailprice function but call calculateRetailPrice...
C++ names are case-sensitive.
A linker detects undefined reference to calculateRetailPrice...

One letter price ;)

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

// Declaring prototypes

void displayWelcome();
double correctCost(double);
double getMarkUp(string);
void calculateRetailPrice(int, double, double, double &, double &,
double &);
void displayResults(string, int, double, double, double, double, double);

int main ()
{
     // Declaring variables
     int quantity = 0;
     double wholeSaleCost = 0, percMarkUp = 0;
     double amountMarkUp= 0, salesTax = 0, retailPrice = 0;
     string item;

     displayWelcome();

     cin >> item;
     cin >> quantity;
     cin >> wholeSaleCost;

     cout << "\n" <<endl;
     cout << "Item Name Quantity      ";
     cout << setw(15) << "Unit Price";
     cout << setw(15) << "Markup %";
     cout << setw(15) << "Markup";
     cout << setw(12) << "Tax";
     cout << setw(20) << "Retail Price";
     cout << endl;

     // Loop with Sentinel value

     while(item != "Done" && quantity != 0 && wholeSaleCost != 0)
     {
          // Less than 1000 test

          if (wholeSaleCost > 1000)
          {
               wholeSaleCost = correctCost(wholeSaleCost);
          }

          percMarkUp = getMarkUp(item);

          calculateRetailPrice(quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          displayResults(item, quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          cin >> item;
          cin >> quantity;
          cin >> wholeSaleCost;
     }
     return 0;
}

void displayWelcome ()
{
     cout << "*****************************************************************"<<e$
     cout <<"* Welcome to ABX. I am Alete, your manager. *" <<endl;
     cout <<"* Here is a summary of your purchases. *" <<endl;
     cout << "****************************************************************"<<en$
}
double correctCost (double wholeSaleCost)
{
     return wholeSaleCost / 100;
}
double getMarkUp(string item)
{
     double percent;
     if (item == "Bracelet" || item == "Earrings")
     percent = 1;
     else if (item == "Necklace")
     percent = .3;
     else if (item == "ToeRing")
     percent = .05;
     else if (item == "KeyFob")
     percent = .25;
     else if (item == "Cufflink")
     percent = .5;

     return percent;
}
void calculateRetailprice(int quantity, double wholeSaleCost, double
percMarkUp, double &amountMarkUp, double &salesTax, double &retailPrice)
{
     double subTotal;
     amountMarkUp = wholeSaleCost * percMarkUp;
     subTotal = (wholeSaleCost + amountMarkUp) * quantity;
     salesTax = subTotal * .06;
// ????
// salesTax=subTotal*0.06;
     retailPrice = salesTax + subTotal;
}
void displayResults(string item, int quantity, double wholeSaleCost,
double percMarkUp, double amountMarkUp, double salesTax, double
retailPrice)
{
     percMarkUp = percMarkUp * 100;

     cout << setprecision(2) <<fixed;
     cout << left << setw(10) << item;
     cout << "   " << left <<  setw(3) << quantity << "                 ";
     cout << "$" << left << setw(10) << wholeSaleCost;
     cout << right << setprecision(0) << fixed << setw(8) <<percMarkUp <<
"%";
     cout << setprecision(2) << fixed;

     cout << "             $" << left << setw(14) << amountMarkUp;
     cout << "$" << left << setw(11) << salesTax;
     cout << "$" << left << setw(15) << retailPrice <<endl;
}


[/code[code=c++]
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;


// Declaring prototypes


void displayWelcome();
double correctCost(double);
double getMarkUp(string);
void calculateRetailPrice(int, double, double, double &, double &,
double &);
void displayResults(string, int, double, double, double, double, double);


int main ()
{
// Declaring variables
int quantity = 0;
double wholeSaleCost = 0, percMarkUp = 0;
double amountMarkUp= 0, salesTax = 0, retailPrice = 0;
string item;


displayWelcome();


cin >> item;
cin >> quantity;
cin >> wholeSaleCost;


cout << "\n" <<endl;
cout << "Item Name Quantity      ";
cout << setw(15) << "Unit Price";
cout << setw(15) << "Markup %";
cout << setw(15) << "Markup";
cout << setw(12) << "Tax";
cout << setw(20) << "Retail Price";
cout << endl;


// Loop with Sentinel value


while(item != "Done" && quantity != 0 && wholeSaleCost != 0)
{
// Less than 1000 test


if (wholeSaleCost > 1000)
{
wholeSaleCost = correctCost(wholeSaleCost);
}


percMarkUp = getMarkUp(item);


calculateRetailPrice(quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);


displayResults(item, quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);


cin >> item;
cin >> quantity;
cin >> wholeSaleCost;
}
return 0;
}


void displayWelcome ()
{
cout << "*****************************************************************"<<e$
cout <<"* Welcome to ABX. I am Alete, your manager. *" <<endl;
cout <<"* Here is a summary of your purchases. *" <<endl;
cout << "****************************************************************"<<en$
}
double correctCost (double wholeSaleCost)
{
return wholeSaleCost / 100;
}
double getMarkUp(string item)
{
double percent;
if (item == "Bracelet" || item == "Earrings")
percent = 1;
else if (item == "Necklace")
percent = .3;
else if (item == "ToeRing")
percent = .05;
else if (item == "KeyFob")
percent = .25;
else if (item == "Cufflink")
percent = .5;


return percent;
}
void calculateRetailprice(int quantity, double wholeSaleCost, double
percMarkUp, double &amountMarkUp, double &salesTax, double &retailPrice)
{
double subTotal;
amountMarkUp = wholeSaleCost * percMarkUp;
subTotal = (wholeSaleCost + amountMarkUp) * quantity;
salesTax = subTotal * .06;
// ????
// salesTax=subTotal*0.06;
retailPrice = salesTax + subTotal;
}
void displayResults(string item, int quantity, double wholeSaleCost,
double percMarkUp, double amountMarkUp, double salesTax, double
retailPrice)
{
percMarkUp = percMarkUp * 100;


cout << setprecision(2) <<fixed;
cout << left << setw(10) << item;
cout << "   " << left <<  setw(3) << quantity << "                 ";
cout << "$" << left << setw(10) << wholeSaleCost;
cout << right << setprecision(0) << fixed << setw(8) <<percMarkUp <<
"%";
cout << setprecision(2) << fixed;


cout << "             $" << left << setw(14) << amountMarkUp;
cout << "$" << left << setw(11) << salesTax;
cout << "$" << left << setw(15) << retailPrice <<endl;
}
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

// Declaring prototypes

void displayWelcome();
double correctCost(double);
double getMarkUp(string);
void calculateRetailPrice(int, double, double, double &, double &,
double &);
void displayResults(string, int, double, double, double, double, double);

int main ()
{
     // Declaring variables
     int quantity = 0;
     double wholeSaleCost = 0, percMarkUp = 0;
     double amountMarkUp= 0, salesTax = 0, retailPrice = 0;
     string item;

     displayWelcome();

     cin >> item;
     cin >> quantity;
     cin >> wholeSaleCost;

     cout << "\n" <<endl;
     cout << "Item Name Quantity      ";
     cout << setw(15) << "Unit Price";
     cout << setw(15) << "Markup %";
     cout << setw(15) << "Markup";
     cout << setw(12) << "Tax";
     cout << setw(20) << "Retail Price";
     cout << endl;

     // Loop with Sentinel value

     while(item != "Done" && quantity != 0 && wholeSaleCost != 0)
     {
          // Less than 1000 test

          if (wholeSaleCost > 1000)
          {
               wholeSaleCost = correctCost(wholeSaleCost);
          }

          percMarkUp = getMarkUp(item);

          calculateRetailPrice(quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          displayResults(item, quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          cin >> item;
          cin >> quantity;
          cin >> wholeSaleCost;
     }
     return 0;
}



void displayWelcome ()
{
     cout << "*****************************************************************"<<e$
     cout <<"* Welcome to ABX. I am Alete, your manager. *" <<endl;
     cout <<"* Here is a summary of your purchases. *" <<endl;
     cout << "****************************************************************"<<en$
}
double correctCost (double wholeSaleCost)
{
     return wholeSaleCost / 100;
}
double getMarkUp(string item)
{
     double percent;
     if (item == "Bracelet" || item == "Earrings")
     percent = 1;
     else if (item == "Necklace")
     percent = .3;
     else if (item == "ToeRing")
     percent = .05;
     else if (item == "KeyFob")
     percent = .25;
     else if (item == "Cufflink")
     percent = .5;

     return percent;
}
void calculateRetailprice(int quantity, double wholeSaleCost, double
percMarkUp, double &amountMarkUp, double &salesTax, double &retailPrice)
{
     double subTotal;
     amountMarkUp = wholeSaleCost * percMarkUp;
     subTotal = (wholeSaleCost + amountMarkUp) * quantity;
     salesTax = subTotal * .06;
// ????
// salesTax=subTotal*0.06;
     retailPrice = salesTax + subTotal;
}
void displayResults(string item, int quantity, double wholeSaleCost,
double percMarkUp, double amountMarkUp, double salesTax, double
retailPrice)
{
     percMarkUp = percMarkUp * 100;

     cout << setprecision(2) <<fixed;
     cout << left << setw(10) << item;
     cout << "   " << left <<  setw(3) << quantity << "                 ";
     cout << "$" << left << setw(10) << wholeSaleCost;
     cout << right << setprecision(0) << fixed << setw(8) <<percMarkUp <<
"%";
     cout << setprecision(2) << fixed;

     cout << "             $" << left << setw(14) << amountMarkUp;
     cout << "$" << left << setw(11) << salesTax;
     cout << "$" << left << setw(15) << retailPrice <<endl;
}

.............. Can't believe I missed that...

Thanks, SSR

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.