Need help with Ice Cream and Candy assignment

I just want to say that I am so tired of not understand any single word that comes out of my instructor’s mouth. After talking with an advisor, I learned that I am in a wrong Computer Science I class since there is 2 other classes that should be taken prior to a Computer Science class which make no sense because the course state’s that it’s an “Introduction to Computer Science” and the textbook states “No prior knowledge needed” and that the reading the material is easily understood. That’s a bold out lie. Anyways, the instructor (even with great programming knowledge) is terrible with his ‘I don’t give a shit about your life’ attitude he gives off when I try to explain to him my situation. Sad to say that I have to pass this class, otherwise I am no longer eligible for Financial Aid plus I am no longer getting paid by the Vet program for attending school. I tried listening to class, read every single chapter so far and stayed after class and ask the instructor a lot of questions and still retaining any information in my head. The instructor gave me the formula for the previous assignments so I did it on my own did well but the problem is that I’m not learning anything. For this assignment, it is way too confusing to understand and unsure where to even start. I’m going to list below the assignment info and I hope someone can help me code this. It’s my last resort to feel like I’m cheating, but it’s my life that I have to control before I get denied of any future education.

Assignment:
Write a program to calculate the bill for an ice cream and candy store. This assignment is an extension of assignment 2, with the addition of choices of flavors and extras for ice cream, so you can use assignment 2 as the basis for this assignment. Your program will tell the user how much a scoop of vanilla, strawberry, and chocolate ice cream costs, and then ask them how many scoops they would like to order. In addition, the user will be able to select whipped cream, hot fudge sauce, or sprinkles for their ice cream. Extras are calculated per scoop, so multiply the cost of the extras by the number of scoops. Then ask the customer if they would like any lollypops and/or gumdrops. After the user makes their selection, your program will print out an itemized receipt, and a total bill at the bottom. This time though, if the user does not select an item, it should not appear on the receipt. You may handle this two ways: by asking if they would like an item and allow them to say yes or no, or by asking how many of an item they would like. If the user says no or if they say zero for any item, then it should not appear on the receipt. Therefore, no item should cost $0.00, with the exception of the grand total if no items are ordered. Please see the sample output sections for details.

Here are the prices for the items listed above:

Ice Cream Other Items
1 Scoop of Vanilla Ice cream $1.15 1 Lollypop $0.79
1 Scoop of Strawberry Ice cream $1.20 1 Package of Gumdrops $0.55
1 Scoop of Chocolate Ice cream $1.25

Extras
Sprinkles, 15¢ per scoop.
Hot Fudge, 20¢ per scoop.
Whipped Cream, 10¢ per scoop.
Sample Output 1 (user input is in bold):
Welcome to Rob’s Ice Cream and Candy Store!
Vanilla ice cream scoops are $1.15, strawberry scoops are $1.20, and
Chocolate scoops are $1.25. How many scoops would you like?: 2
What flavor would you like? (V)anilla, (S)trawberry or (C)hocolate: S
Sprinkles are $0.15 per scoop. Would you like sprinkles?(Y or N): Y
Hot Fudge is $.20 per scoop. Would you like hot fudge?(Y or N): N
Whipped Cream is $0.10 per scoop. Would you like whipped cream?(Y or N): Y
Lollypops are $0.79. Would you like some lollypops? (Y or N): Y
How many lollypops would you like?: 2
Gumdrops are $0.55. Would you like some gumdrops? (Y or N): N
-------------------------------------
Thank you for your order:
2 scoops of strawberry ice cream at $1.20 per scoop.
Ice cream extras:
Sprinkles, $0.15 per scoop.
Whipped Cream, $0.10 per scoop.
Charge for ice cream and extras: $2.90.
2 lollypops at $0.79, charge $1.58.
Total Charge: $3.48.
-------------------------------------
Thanks for your order, Enjoy!
Sample Output 2 (user input is in bold):
Welcome to Rob’s Ice Cream and Candy Store!
Vanilla ice cream scoops are $1.15, strawberry scoops are $1.20, and
Chocolate scoops are $1.25. How many scoops would you like?: 0
Lollypops are $0.79. Would you like some lollypops? (Y or N): Y
How many lollypops would you like?: 2
Gumdrops are $0.55. Would you like some gumdrops? (Y or N): Y
How many gumdrops would you like?: 3
-------------------------------------
Thank you for your order:
2 lollypops at $0.79, charge $1.58.
3 gumdrops at $0.55, charge $1.65.
Total Charge: $3.23.
-------------------------------------
Thanks for your order, Enjoy!
Sample Output 3 (user input is in bold):
Welcome to Rob’s Ice Cream and Candy Store!
Vanilla ice cream scoops are $1.15, strawberry scoops are $1.20, and
Chocolate scoops are $1.25. How many scoops would you like?: 2
What flavor would you like? (V)anilla, (S)trawberry or (C)hocolate: V
Sprinkles are $0.15 per scoop. Would you like sprinkles?(Y or N): N
Hot Fudge is $.20 per scoop. Would you like hot fudge?(Y or N): N
Whipped Cream is $0.10 per scoop. Would you like whipped cream?(Y or N): N
Lollypops are $0.79. Would you like some lollypops? (Y or N): N
Gumdrops are $0.55. Would you like some gumdrops? (Y or N): N
-------------------------------------
Thank you for your order:
2 scoops of vanilla ice cream at $1.15 per scoop.
Charge for ice cream and extras: $2.30.
Total Charge: $2.30.
-------------------------------------
Thanks for your order, Enjoy!
What is it that you want to know (besides how to read your schedule of classes ;)?
Here you go!

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

bool cice(char choice)
{
    switch(choice)
    {
    case 'y':
    case 'Y':
        return true;
        break;
    case 'n':
    case 'N':
        return false;
        break;
    default:
        return -1;
    }
}

int main(int nNumberofArgs,char* pszARgs[])
{
    char flavor,choice;
    int scoops,nLolli,nGum;
    double iPrice = 0,total = 0,iTotal = 0,sTotal = 0,fTotal = 0,cTotal = 0,lTotal = 0,gTotal = 0;
    string IceC;
    bool ice = false,lollipop = false,gumdrops = false,sprinkles = false,fudge = false,cream = false;
    for(;;)
    {
        cout << endl << endl;
        cout << "Welcome to the ice cream store!" << endl;
        cout << "Would you like Vanilla, Strawberry, or Chocolate?" << endl;
        cout << "(V)anilla - $1.15" << endl;
        cout << "(S)trawberry - $1.20" << endl;
        cout << "(C)hocolate - $1.25" << endl;
        cout << "(N)one" << endl;
        cout << "Flavor: ";
        cin >> flavor;

        switch(flavor)
        {
        case 'v':
        case 'V':
            iPrice = 1.15;
            IceC = "vanilla";
            break;
        case 's':
        case 'S':
            iPrice = 1.20;
            IceC = "strawberry";
            break;
        case 'c':
        case 'C':
            iPrice = 1.25;
            IceC = "chocolate";
            break;
        case 'n':
        case 'N':
            goto snacks;
        default:
            cout << "Please enter V,S, or C!" << endl;
        }

        ice = true;
        cout << endl << "How many scoops of " << IceC << " would you like? : ";
        cin >> scoops;
        if(scoops < 0)
        {
            cout << "Error: You cannot have negative scoops!" << endl;
        }

        iTotal = scoops * iPrice;

        cout << endl << "Extras!" << endl << "------------------------------------" << endl;
        cout << "Would you like sprinkles? $0.15 per scoop (Y or N): ";
        cin >> choice;
        sTotal = .15 * scoops;
        sprinkles = cice(choice);

        cout << "Would you like hot fudge? $0.20 per scoop (Y or N): ";
        cin >> choice;
        fTotal = .2 * scoops;
        fudge = cice(choice);

        cout << "Would you like whipped cream? $0.10 per scoop (Y or N): ";
        cin >> choice;
        cTotal = .1 * scoops;
        cream = cice(choice);

        snacks:
        cout << endl << "Snacks!" << endl << "------------------------------------" << endl;
        cout << "Would you like a lollipop? $0.79 (Y or N): ";
        cin >> choice;

        lollipop = cice(choice);
        if(lollipop)
        {
            cout << "How many lollipops would you like?: ";
            cin >> nLolli;
            lTotal = .79 * nLolli;
        }

        cout << "Would you like a pack of gumdrops? $0.55 (Y or N): ";
        cin >> choice;

        gumdrops = cice(choice);
        if(gumdrops)
        {
            cout << "How many packs would you like?: ";
            cin >> nGum;
            gTotal = .55 * nGum;
        }
        cout << "------------------------------------" << endl;

        total = scoops * iPrice;
        if(sprinkles)
        {
            total += .15 * scoops;
        }
        if(fudge)
        {
            total += .2 * scoops;
        }
        if(cream)
        {
            total += .1 * scoops;
        }
        if(lollipop)
        {
            total += .79 * nLolli;
        }
        if(gumdrops)
        {
            total += .55 * nGum;
        }
        cout << "Receipt: " << endl;
        if(ice)
        {
           cout << scoops << " scoops of " << IceC << " = $" << iTotal << endl;
        }
        cout << "Extras: " << endl;
        if(sprinkles)
        {
            cout << "Sprinkles: " << scoops << " scoops * $0.15 = $" << sTotal << endl;
        }
        if(fudge)
        {
            cout << "Hot Fudge: " << scoops << " scoops * $0.20 = $" << fTotal << endl;
        }
        if(cream)
        {
            cout << "Whipped Cream: " << scoops << " scoops * $0.10 = $" << cTotal << endl;
        }
        if(lollipop)
        {
            cout << nLolli << " lollipops = $" << lTotal << endl;
        }
        if(gumdrops)
        {
            cout << nGum << " gumpacks = $" << gTotal << endl;
        }
        cout << "-----------------------" << endl;
        cout << "Total: $" << total << endl;
        cout << "-----------------------" << endl;
        cout << endl << "Would you like to buy some more?(Y or N): ";
        cin >> choice;
        switch(choice)
        {
        case 'y':
        case 'Y':
            break;
        case 'n':
        case 'N':
            system("PAUSE");
            return 0;
        default:
            cout << "Please enter Y or N!" << endl;
            system("PAUSE");
            return 0;
        }
    }
}
Last edited on
Thank you so much greenleaf800073. I'll test it out now.
There's 4 errors but don't worry, it's something I'll ask the instructor about tomarrow if he's willing to help/guide me.
What are the exact errors you encountered? Don't worry, it can be fixed. Please? **lol**
Errors?
Sorry, didn't have enough time to fix run time bugs
Just updated program above
Ah, don't worry about it. Thank you for your help GreenLeaf. I used your formula along with my previous assignment to help guide me. I didn't want to copy and past since there is a lot of terms I did not learn/remember in class yet. Here is my finished one:

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

const double CHOCOLATE = 1.25;
const double STRAWBERRY = 1.20;
const double VANILLA = 1.20;

int main ()
{


char choice;
int iceCreamScoops;
double icescreamscoopsCost = 1.15;
int icescreamscoopsQuantity;
double icescreamscoopsTotal;
char reply;

int cream;
char flavor;
string flavorName;
int scoops;
double flavorCost;
double creamCost = 0.10;
double creamTotal;

int hot;
double hotCost = 0.20;
double hotTotal;

int sprinkles;
double sprinklesCost = 0.15;
double sprinklesTotal;

int lollypops;
double lollypopsCost = 0.79;
int lollypopsQuantity;
double lollypopsTotal;

int gumdrops;
double gumdropsCost = 0.55;
int gumdropsQuantity;
double gumdropsTotal;

double saleTotal;

cout << fixed << showpoint << setprecision(2);
cout << "Welcome to Jerry's Ice Cream and Candy store!" << endl;
cout << "Would you like some (V)anilla, (S)trawberry, or (C)hocolate ice cream? ";
cout << "(V)anilla - $1.15" << endl;
cout << "(S)trawberry - $1.20" << endl;
cout << "(C)hocolate - $ 1.25" << endl;
cout << "What's your choice? ";
cin >> flavor;

if(flavor == 'C')
{
flavorName = "Chocolate";
flavorCost = CHOCOLATE;
}

else if (flavor == 'S')
{
flavorName = "StrawBerry";
flavorCost = STRAWBERRY;
}

else if (flavor == 'V')
{
flavorName = "Vanilla";
flavorCost = VANILLA;
}
cout << "How many scoops do you want? ";
cin >> iceCreamScoops;

cout << "Would you like whipped cream? $0.10 per scoop (Y or N): ";
cin >> choice;
if(choice == 'Y' || choice == 'y')
{
creamTotal = iceCreamScoops * creamCost;
cout << "Total for Whipped Cream: $" << creamTotal << endl;
}
else
creamTotal = 0.0;

cout << "Would you like Hot Fudge? $0.20 per scoop (Y or N): ";
cin >> choice;
if(choice == 'Y' || choice == 'y')
{
hotTotal = iceCreamScoops * hotCost;
cout << "Total for Hot Fudge? $" << hotTotal << endl;
}
else
hotTotal = 0.0;

cout << "Would you like Sprinkles? $0.15 per scoop (Y or N): ";
cin >> choice;
if(choice == 'Y' || choice == 'y')
{
sprinklesTotal = iceCreamScoops * sprinklesCost;
cout << "Total for Sprinkles? $" << sprinklesTotal << endl;
}
else
sprinklesTotal = 0.0;

icescreamscoopsTotal = iceCreamScoops * flavorCost + creamTotal + hotTotal + sprinklesTotal;
cout << "Total for " << flavorName << " Ice Cream: $" << icescreamscoopsTotal << endl;

cout << "Would you like some Lollypops? $0.79 each (Y or N): ";
cin >> choice;
if(choice == 'Y' || choice == 'y')
{
cout << "How many Lollypops do you want? ";
cin >> lollypops;
lollypopsTotal = lollypops * lollypopsCost;
cout << "Total for Lollypops: $" << lollypopsTotal << endl;
}
else
lollypopsTotal = 0.0;

cout << "Would you like some Gumdrops? $0.55 each (Y or N): ";
cin >> choice;
if(choice == 'Y' || choice == 'y' )
{
cout << "How many Gumdrops do you want? ";
cin >> gumdrops;
gumdropsTotal = gumdrops * gumdropsCost;
cout << "Total for Gumdrops: $" << gumdropsTotal << endl;
}
else
gumdropsTotal = 0.0;

saleTotal = icescreamscoopsTotal + CHOCOLATE + STRAWBERRY + VANILLA + lollypopsTotal+ gumdropsTotal;
cout << "Grand Total of $" << saleTotal << ". Thank you very much for shopping. Have a nice day!" << endl;
cout << "Enter q to quit...";
cin >> reply;
return 0;
}
ya... oh and can you use code tags next time?
What does code tags mean?
Your code you post doesn't look like this

int main()
{

}

but like this

1
2
3
4
int main()
{

}


off to the side, in format, it's the <> button.
Shoot, I don't know how to have and show the 1, 2, 3, 4, codes on the side.
It's automatic
when
[code][/code]
pops up

place code here between the middle ][
Oh, thanks.
Topic archived. No new replies allowed.