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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 #include <iostream>
#include <string>
#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 $" <<sales.Total();



    return 0;
    /*--------------------------------------------------------------------------------------------------------------
    ================================================================================================================
    Chips and Salsa
Write a program that lets a maker of chips and salsa keep track of their sales for five
     different types of salsa they produce: mild, medium, sweet, hot, and zesty. It should use two
    parallel five- element arrays: 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. The salsa names should be
    stored using an initialization list at the time the name array is created. The program should prompt the
    user to enter the number of jars sold for each type. Once this sales data has been entered, the program
    should produce a report that displays sales for each salsa type, total sales, and the names of the highest
    selling and lowest selling products. 

Input Validation: Do not accept negative values for number of jars sold.
    =================================================================================================================
    =================================================================================================================
    ---------------------------------------------------------------------------------------------------------------*/
}

My .h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 #ifndef SALSA_H
#define SALSA_H
#include <string>


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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 #include "Salsa.h"
#include <iostream>
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.