1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int scoops, lollypops, gumdrops, blah;
double totalCharge, lCost, gCost, accIceCreamCost, fullLollyCost, fullGumCost;
char choice = ' ';
double iceCreamCost = 0.0;
string flavor, Vanilla, Strawberry, Chocolate;
cout << fixed << showpoint << setprecision(2);
cout << "Welcome to the Ice Cream and Candy Store!"
<< endl;
cout << "Welcome to the Ice Cream and Candy Store! Chocolate ice cream is"
"\n$3.05, Strawberry is $3.15, and Vanilla is $2.86.What flavor would"
"\nyou like : (C)hocolate, (S)trawberry, or (V)anilla : V " << endl;
cin >> choice;
if ('V' == choice)
flavor = Vanilla;
iceCreamCost = 2.86;
if ('C' == choice)
flavor = Chocolate;
iceCreamCost = 3.15;
if ('S' == choice)
flavor = Strawberry;
iceCreamCost = 3.05;
cout << "How many scoops would you like?" << endl;
cin >> scoops;
cout << "Scoops: " << endl;
cout << "Lollypops are $0.79. How many lollypops would you like? " << endl;
cin >> lollypops;
cout << "Gumdrops are $0.65.How many packages would you like?" << endl;
cin >> gumdrops;
if (lollypops > 0)
lCost = 0.79;
if (gumdrops > 0)
gCost = 0.65;
fullLollyCost = lCost * lollypops;
fullGumCost = gCost * gumdrops;
accIceCreamCost = iceCreamCost * scoops;
totalCharge = lollypops * lCost, gumdrops * gCost;
totalCharge = totalCharge + (iceCreamCost * scoops);
cout << "Thank you for your order: " << endl;
cout << scoops << " scoops of " << flavor << "at " << iceCreamCost;
cout << "charges you: " << accIceCreamCost << endl;
if (lollypops > 0)
cout << lollypops << " at, " << lCost << " charge: " << fullLollyCost << endl;
if (gumdrops > 0)
cout << gumdrops << " at, " << gCost << " charge: " << fullGumCost << endl;
cout << "Total Charge: $" << totalCharge;
cin >> blah;
return 0;
}
|