Uploaded by Abe Khan

Project no 2 FOP

advertisement
SZABIST
SHAHEED ZULFIQAR ALI BHUTTO UNIVERSITY OF SCIENCE
AND TECHNOLOGY
SUBMITTED TO: SIR NAVEED
SUBMITTED BY : ABDULLAH FEROZ
REG NO:2180170
PROGRAM EXPLANATION:
• C++ program for a new ice cream vendor called PopSalon.
• The management of PopSalon has decided that they are going to sell their popcorn in 11 different
flavors.
• PopSalon is charging Rs. 100 for small pack, Rs. 250 for medium sized pack, Rs. 500 for large
sized pack and Rs. 750 large size tin pack
• user enters option number other than the ones displayed, your program should display an invalid
input message and ask the user to re-enter the option number.
• PopSalon allows its customers to purchase a gift wrapper with their popcorn. If the customer wants
to purchase the wrapper he will have to pay an additional Rs 50
PROGRAM EXPLANATION:
• The program should show a menu that asks the customer for his
requirements and then displays the final payable amount with full
details about the flavor, the size of the pack and details regarding any
additional toppings
• For service quality inspection and monthly product promotions, the
program should ask the user to enter his/her contact details including
name, mobile number and email address, and select between the
options good, neutral and bad against the quality of the service
provided.
PROGRAM CODE:
•
Header Files
• #include<iostream>
• #include <string>
• using namespace std;
PROGRAM CODE:(DATA TYPES
VARIABLES)
•
string flavor;
•
string size;
•
string gift_wraper;
•
string topping;
•
double total;
•
string name;
•
string contact;
•
string email;
•
string quality;
•
string complain;
PROGRAM CODE:
•
/*chocolate, English toffee,
• salted caramel, caramel, jalapeno, cheese, spiced cheese, plain sated, buttered, salt and pepper, and garlic.*/
•
int set_flavor()
•
{
•
int a;
•
do
•
{
cout << "\n We have Best 11 Flavors given below \n";
cout << "Press 1 for Chocolate\n";
cout << "Press 2 for English toffee\n";
cout << "Press 3 for Salted caramel\n";
cout << "Press 4 for Caramel\n";
cout << "Press 5 for Jalapeno\n";
cout << "Press 6 for Cheese\n";
cout << "Press 7 for Spiced Cheese\n";
cout << "Press 8 for Plain Salted\n";
cout << "Press 9 for Buttered\n";
cout << "Press 10 for Salt & Pepper\n";
cout << "Press 11 for Garlic\n";
cin >> a;
USING SWITCH NEXT
•
switch (a)
•
{
•
case 1:
•
flavor = "Chocolate";
•
break;
•
case 2:
•
flavor = "English toffee";
•
break;
•
case 3:
flavor = "Salted caramel";
break;
case 4:
flavor = "Caramel";
break;
case 5:
flavor = "Jalapeno";
break;
case 6:
flavor = "Cheese";
break;
case 7:
flavor = "Spiced Cheese";
break;
case 8:
flavor = "Plain Salted";
case 9:
flavor = "Buttered";
break;
case 10:
flavor = "Salt & Pepper";
break;
case 11:
flavor = "Garlic";
break;
}
LOOPS:
•
•
while ( a != 1 && a != 2 && a != 3 && a != 4
&& a != 5 && a != 6 && a != 7 && a != 8 && a !=
9 && a != 10 && a!= 11 );
}
FUNCTIONS:
•
int set_size()
•
{
•
int a;
•
do{
•
cout << "Press 1 for Small (100 PKR)\n";
•
cout << "Press 2 for Medium (250 PKR)\n";
•
cout << "Press 3 for Large (500 PKR)\n";
•
cout << "Press 4 for Large size Tin pack (750 PKR)\n";
cout << "\nPlease Select Size\n";
cin >> a;
switch (a)
{
case 1:
size = "Small";
total = 100;
break;
case 2:
size = "Medium";
total = 250;
break;
case 3:
size = "Large";
total = 500;
break;
case 4:
size = "Large Tin";
total = 750;
break;
}
} while (a != 1 && a != 2 && a != 3 && a != 4);
int set_topping()
{
int b;
char a;
do
{
cout << "\nDo yo need addittional topping Press Y / N\n";
cin >> a;
if (a == 'y' || a == 'Y')
{
cout << "Press 1 for Chocolate sauce (50 PKR)\n";
cout << "Press 2 for Caramel sauce (30 PKR)\n";
cout << "Press 3 for Melted cheese (60 PKR)\n";
cin >> b;
switch (b)
{
case 1:
topping = "Chocolate sauce";
total += 50;
break;
case 2:
topping = "Caramel sauce";
total += 30;
break;
case 3:
topping = "Meleted cheese";
total += 60;
break;
}
}
else
{
topping = "Not Required";
}
} while (b != 1 && b != 2 && b != 3);
}
int set_wrapper()
{
char a;
cout << "\nWould you like to have gift wrapper (50 PKR) Press Y or N\n";
cin >> a;
if (a == 'y' || a == 'Y')
{
gift_wraper = "Required";
total += 50;
}
else
{
gift_wraper = "Not Required";
}
}
int set_customer_dtls()
{
int a;
cout << "\nFor service quality inspection\n";
cin.ignore();
cout << "Please Enter your name\n";
getline(cin, name);
cout << "Please Enter your contact number\n";
getline(cin, contact);
cout << "Please Enter your E-mail address\n";
getline(cin, email);
cout << "\nHow was the quality of service at PopSalon\n";
cout << "Press 1 for Good\n";
cout << "Press 2 for Neutral\n";
cout << "Press 3 for Bad\n";
cin >> a;
if (a == 1)
{
quality = "Good";
cout<<"Thank you for you feedback we wil improve more\n";
}
else if (a == 2)
{
quality = "Neutral";
cout<<"thank you for you feedback we will improve more\n";
}
else if (a == 3)
{
quality == "bad";
cout<<"Thank you for your feedback what is your complain, please write down, we will
improve\n";
cin>>complain;
}
else
{
cout << "Please select a valid option\n";}
}
int getter()
{
cout << "\nYour choice of Pop Corn is:\n";
cout << "Flavor= " << flavor << endl;
cout << "Pack size= " << size << endl;
cout << "Topping= " << topping << endl;
cout << "Gift wrapper= " << gift_wraper << endl;
cout << "Total Bill= " << total << endl;
}
~popsalon()
//destructor
{
cout << "\nThank you for visiting PopSalon!\n";
}
};
MAIN PROGRAM:
• int main()
•{
•
cout << "
• popsalon var;
•
var.set_flavor();
•
var.set_size();
•
var.set_topping();
•
var.set_wrapper();
•
var.set_customer_dtls();
Welcome to PopSalon
\n";
RESULTS/OUTPU
TS:
THANK YOU
Download