geting the default costructor in class using array

cashRegisiter class simulates the sale of a product. Cashregisiter has an array that can hold retailItem objects, a constant for VAT rate and a variable to store total sales
(1) default constructor to initializes the class data retailItem with a max of 10 objects
(2)class getSubtotal that returns the sum of the quanity multiply by the retail price for the retailItem stored

any one can help??

Last edited on
What?
class retailitem
{
private:
double RP // variable for retail price
string PD // variable for product description
string num1 // variable for item
public:
retailitem(double RP, string PD, string num1);
string getdescription() const;
string getItem () const;
double getRetailprice ();
}

retailitem::retailitem(double RP, string PD, string num1);
: RP(RP),
PD(PD),
num1(num1)
{
}


this the first part of the program
the accessor methods for getting the values of retailitem have been done
which is class in a class
Last edited on
BLACKHULK wrote:
this the first part of the program
the accessor methods for getting the values of retailitem have been done
which is class in a class
I read that as, "This is the first part of the program. The accesor methods for getting the values of retalitem have already been done. (I can't understand the last sentence.)"

What is your question/problem?
this is the problem?

cashRegisiter class simulates the sale of a product. Cashregisiter has an array that can hold retailItem objects, a constant for VAT rate and a variable to store total sales

question how do you get:
(1) default constructor to initializes the class data with appropriate values. the array of the class retailItem will hold a max of 10 objects

question how do you go about:
(2)class getSubtotal that returns the sum of the quanity multiply by the retail price for all the retailItem stored in the class.
Something like this:
1
2
3
4
5
6
7
8
9
10
11
12
class cashRegisted {
 private:
    retailItem items[10];
    int itemsLength;

 public:
    cashRegister() : itemsLength(0) {}

    double getSubtotal() const;
    void addItem(const retailItem&);
    void removeItem(const retailItem&);
};

I'm not sure I completely understand the calculations you need to do. What is the "VAT rate?" What do you mean by "returns the sum of the quanity multiply by the retail price for all the retailItem?" Did you mean method getSubtotal, instead of class getSubtotal, because verbs are usually methods, where as classes are usually nouns.
Last edited on
getSubtotal is the right way not a classes
VAT rate is part of the public

where their is more questions to this problem where you have to

getTAX : method of should return the amount o sales tax/VAT on the purchase tax rate =6% of the subtotal.

and

getTotal : that returns the total value of the sale. which is subtotal plus the sales tax.

Last edited on
VAT might be public, but what does it mean/do?
VAT is a way taxing the products
Topic archived. No new replies allowed.