Hey there. I'm designing a program that will ask the user for an ice cream flavor, a sauce flavor, and whether or not they want sprinkles. I am having two problems:
1. Since chocolate is both an option under sauce and icecream, if I select chocolate for a sauce, it changes the ice cream flavor instead. I can't figure out how to lock in the input then progress to the next one.
2. I can't seem to get the sprinkles option to ask the question. Also if you can see by my code, is this a good way to go about doing it?
The way your program is set up currently, it only asks for input once; so the user can only enter one of the answers to your questions. You should probably ask for input three times (once after each question) and set the field immediately rather than after all the questions.
It lets me ask all three options and ask for input for each. However, if I try to put those in an if..else format, it won't. Could this be because I made sprinkles == ""?
In psuedocode, I would say you should adjust the program to look like so: while loop
print flavor question
get flavor input
set flavor
print sauce question
get sauce input
set sauce
print sprinkles question
get sprinkles input
set sprinkles
end while loop
print results
Currently, your program works like so: while loop
print flavor question
print sauce question
print sprinkles question
get input (which somehow is supposed to answer all the questions)
set flavor based on input
set sauce based on same input (why don't they get to input a sauce?)
set sprinkles based on same input (why don't they get to input a sprinkles?)
end while loop
print results
Which seems odd to me. It's like like having a form you are filling out a form with three entries but only one space to write a response.
I am thinking my instructor wants this a specific way. Here's the exact question:
Write a program that asks the user to order an ice cream treat. The user selects the type of ice cream, the sauce, and whether or not to add sprinkles. Use the screen shots below as a guide. Note that the user can answer the questions in any order and can change his/her mind. Also note that the "chocolate" may refer to either the ice cream or the sauce; assume the answer "chocolate" refers to sauce if the ice cream flavor has already been selected, otherwise assume it refers to the ice cream flavor.
This is why it's only having me ask one question at a time.