Given task:
METRO SUPER STORE
Objectives achieved:
The attain
objectives are:
1: 5 different products.
2: 5 brands of five different
products.
3: Each brand contains five different
items.
4: customer will chose the product,
will pay amount and the calculation occur according to the given amount.
Parameters:
Program has the
following parameters:
·
We use multilevel
Inheritance.
·
5 different
classes.
·
Switch statement.
·
If else
conditions.
·
Go-to statement.
· File handling.
Source Code:
#include<iostream>
#include<fstream>
using namespace std;
class electronics
{
private:
int m;
double remaining;
int p;
string led;
string machines;
public:
void mob()
{
b:
int c;
cout<<"enter the company of mobile u want\n";
cout<<"[1].samsung\n[2]apple\n[3]huawei\n[4].oopo\n";
cin>>c;
if(c==1)
{a:
cout<<" <<<<<<samsung>>>>>>>>>"<<endl;
cout<<"samsung mobiles are as follows"<<endl;
cout<<"[1].galaxy A80\n[2]galaxy M30\n.[3]galaxy M10\n[4]galaxy S10\n";
cout<<"which mobile u want"<<endl;
cin>>m;
if(m==1)
{
double d,p,Rs=10000;
cout<<"u have chosen galaxy A80\n"<<endl;
cout<<"its price is only Rs10,000\n";
cout<<"you want to buy\n1 for yes and 2 for no"<<endl;
cin>>d;
if(d==1)
{
cout<<"paying amoount"<<endl;
cin>>p;
cout<<"given amount ="<<p;
if(p>Rs)
{
remaining=p-Rs;
if(p-Rs==0)
{
cout<<"no reaming amount"<<endl;
}
else
{
cout<<"remaing amount"<<remaining<<endl;
}
}
else
{
cout<<"u have not enough money\n";
}
}
else
{
int o;
cout<<"u wan another mobile\n[1]for choosing\n[2].main menu";
cin>>o;
switch(o)
{
case 1:
goto a;
case 2:
goto b;
}
}
}
ofstream fout;
fout.open("mob.txt",ios::out|ios::app);
fout<<endl<<m<<" "<<p<<" "<<remaining;
fout.close();
}
}
};
int main()
{
electronics obj;
obj.mob();
}
0 Comments