Homework
Classes
1 class SaleItem
2 {
3 public:
4 double getprice();
5 void setprice(double);
6 void setName(string);
7 string getName();
8 double TotalItemsPrice(int);
9 private:
10 double
price;
11 string name;
12 };
SaleItem chocolate,
candy;
double
pr;
which of the following is legal in the main program? If not, why?
a) chocolate.price
= .50;
b) chocolate.setName(“kitKat”);
c) pr = candy.getprice();
d) chocolate = candy;
e) cout
<< candy.getName();