### Passing double around for several functions.

I am writing a program for Salsa sales.

For now I want to know, how do I pass the numbers that I input for salsa sales, along to the Total function?

I am still missing a few things.
1: IsValid function(makes it so negative numbers are not accepted)
2: High/Low function(Records the string names of the Highest and lowest inventory counts)
3: Total function(Adds together and Displays sales for all flavors of Salsa)

My main.cpp
 ``12345678910111213141516171819202122232425262728293031323334`` `````` #include #include #include "Salsa.h" using namespace std; int main() { Salsa sales; cout << "Regale me of the month's sales." << endl; cout << "Mild has " << sales.MILD()<< " total sales"; cout << "Medium has " << sales.MED()<< " total sales"; cout << "Sweet has " << sales.SWEET()<< " total sales"; cout << "Hot has " << sales.HOT()<< " total sales"; cout << "Zesty has " << sales.ZESTY()<< " total sales"; //cout << "Total salsa sales are \$" <

My .h
 ``12345678910111213141516171819202122232425262728`` `````` #ifndef SALSA_H #define SALSA_H #include class Salsa { public: Salsa(); Salsa(double Price, double Qty){price = Price; qty = Qty;} double MILD(); double MED(); double SWEET(); double HOT(); double ZESTY(); std::string High(); std::string Low(); virtual ~Salsa(); protected: private: double price, qty; bool Invalid(); //an array of strings that holds the five salsa names and //an array of integers that holds the number of jars sold during the past month for each salsa type. }; #endif // SALSA_H ``````

My .cpp
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107`` `````` #include "Salsa.h" #include using namespace std; Salsa::Salsa() { {price = 0; qty = 0;} cout<< "\nHow much does the salsa cost per jar? \$"; cin>> price; } //________________________________________________ bool Salsa::Invalid() { } //________________________________________________ std::string High() { } //________________________________________________ std::string Low() { } //________________________________________________ double Total() { double Total; return Total; } //________________________________________________ double Salsa::MILD() { double mild, q; cout << "\nHow many jars of Mild salsa were sold? "; cin >> q; mild = price * q; //Total += price; return mild; } //________________________________________________ double Salsa::MED() { double medium, q; cout << "\nHow many jars of Medium salsa were sold? "; cin >> q; medium = price * q; //Total += price; return medium; } //________________________________________________ double Salsa::SWEET() { double sweet, q; cout << "\nHow many jars of Sweet salsa were sold? "; cin >> q ; sweet = price * q; //Total += price; return sweet; } //________________________________________________ double Salsa::HOT() { double hot, q; cout << "\nHow many jars of Hot salsa were sold? "; cin >> q ; hot = price * q; //Total += price; return hot; } //________________________________________________ double Salsa::ZESTY() { double zesty, q; cout << "\nHow many jars of Zesty salsa were sold? "; cin >> q ; zesty = price * q; //Total += price; return zesty; } //________________________________________________ Salsa::~Salsa() { //dtor }``````
Someone take a look! Posted this a few hours ago. hope this helps, I haven't gotten anywhere.
Topic archived. No new replies allowed.