Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a C++ sale program by yourself, you can create any function you want it t

ID: 3859188 • Letter: D

Question

Design a C++ sale program by yourself, you can create any function you want it to have, and please give me a brief summary about what this sale program would preform and how your code works. The following are some specifications you have to meet:

1.demonstrate effective object oriented programming design and implementation ( classes, objects, functions, etc)

2.demonstrate effective use of at least TWO of the data structures ( queues, lists, vectors, etc)

3.demonstrate effective use of either inheritance or polymorphism

Explanation / Answer

Here in this program its sale store which calculte the cost for number of shirts,jeans and shoes purchased.

#include<iostream>
#include<cstring>
using namespace std;
class sale
{
public: //variable declaration
int sh,jn,bt,tsh,tjn,tbt,total;
string name;
void input() //input function
{
cout<<"Enter the name"<<endl; //aceepting the details from the user
cin>>name;
cout<<"Enter the number of shirts "<<endl;
cin>>sh;
cout<<"Enter the number of jeans"<<endl;
cin>>jn;
cout<<"Enter the number of shoes"<<endl;
cin>>bt;
}
void calc() //calc function
{
tsh=200*sh; //calculating the total
tjn=500*jn;
tbt=600*bt;
total=tsh+tjn+tbt;
}
};
class print : public sale //print class inherits sale as public
{
public:
void display() //display function
{
input(); //calling the input function
calc(); //calling the calc function
cout<<"Name : "<<name<<endl; //displayng the result
cout<<"Total price for shirt : "<<tsh<<endl;
cout<<"Total price for jeans : "<<tjn<<endl;
cout<<"Total price for shoes : "<<tbt<<endl;
cout<<"Total price : "<<total<<endl;
}
};
int main() //main function
{
int i;
print obj[2]; //array of objects
for(i=0;i<2;i++)
obj[i].display(); //calling the dislay function
return 0;
}