# looping and for statements

• ### Question

•  this is the assignment and I am stuck on how to do it. I don't need you to do it for me but if you would help me get the program to work I would love that. I am bad at programming and my teacher is not helping. Maybe some examples of problems similar to the one I will post will be a great help. Thanks so much. FYI I have not started this assignment yet.

This is my assignment and any help would be greatly needed:

Jimbob's Pizza would like to make a new, easy to use cash register program. Jimbob's only sells 3 types of pizza: Cheese, Pepperoni, and Deluxe. Each bullet below is a functional requirement that you will be graded on. I suggest that you use this as a checklist when you check-out your program before submitting it.

• Your program must first ask the user how many pizzas they would like to order
• Your program must make sure that the user enters a number between 1 and 20 for the pizza count-- Jimbob's can't handle an order bigger than that). If they enter a number outside of that range, display an error and exit.
• Your program must show the following menu for each pizza that the user would like:

1. Cheese (\$6)

2. Pepperoni (\$10)

3. Deluxe (\$15)

• For each pizza, your program must let the user enter the number of the desired pizza (1, 2, or 3) or the name of the desired pizza (Cheese, Pepperoni, or Deluxe).
• You must use an if ... else if ... etc. block to check the pizza type, and
• For each condition in the if ... else if block you must use a boolean OR to handle checking for both the allowed number and the allowed name.
• The program must be written such that capitalization doesn't matter - PePpErOnI, for instance, should select a Pepperoni pizza.
• Your program must compute a total price for the order. I suggest keeping a running tally as your program runs.
• If the user inputs an invalid selection, your program must inform them that the selection is invalid and that the selection has been automatically changed to "Pepperoni" (you must then add the price of a pepperoni pizza to the total)
• After the input is finished, the program must display
• the total number of pizzas ordered
• the total price
• the tax on the total (use 6%)
• the total including tax.
• You must put the code to get the pizza type in a sub called GetPizzaType.
• You must provide comments for major blocks of code describing the function that they implement
• You must provide a comment for each sub including the sub's name, its purpose, its inputs, and its outputs (look at last week's in-class program for an example)

If you would like to use additional subs (maybe DisplayPizzaMenu, GetPizzaPrice, etc.), that's OK too, but you must have at least the one sub. I suggest having GetPizzaType store its result in a variable called PizzaType, and use a 1, 2, or 3 to indicate which type, but how you actually do this is up to you.

Friday, October 2, 2015 7:21 PM

• That is the easy part and I know how to do that, but its the more complex stuff I do not understand. The book is not much help because it is not a small basic book so the terminology is not the same which gets confusing. Any other help your willing to give me would be greatly appreciated, but I do know i need to learn to do it myself. All I need is a few pointers or starting points because nothing is clicking with me and our in class examples do bot help that much.

Understood. It's very difficult to learn without a book mapping to the language.

There are some good Small Basic books out there that a teacher can use. Could you have your teacher email me?

https://social.msdn.microsoft.com/Forums/en-US/2a5bc56e-c0fc-45ff-a9be-2af599e8d5e0/small-basic-teachers-and-educators-join-our-network?forum=smallbasic

Can you comb through the Getting Started Guide and Curriculum? And the Reference docs? You'll learn a ton and answer your questions you have here.

Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

Sunday, October 4, 2015 8:36 AM

### All replies

• Hi there

Sounds like your teacher wants you to try and do this yourself.

This is a really educational task to solve. Suggest you go through your coarse material on how to setup a form.

A form will allow the user to input data.

Then check that the data entered is correct and allowable e.g. you can't order more than 20 pizzas.

As far as I'm concerned if you do your best to try and solve it or learn how to solve the parts of it then you've been a good student.

What level at school are you in?

Friday, October 2, 2015 10:43 PM

I'm interested to help you. But I do not speak English. I can not do the job quickly.

If it's good for you, then tell me.

Saturday, October 3, 2015 7:29 AM
• You start easy:

Ask the user for the number of pizzas, check the number and for a number outside the range display an error massage.  Get this samll program working before going on.  Then build the nest step, and so on.

Jan [ WhTurner ] The Netherlands

Saturday, October 3, 2015 10:54 AM
• Hi there

Sounds like your teacher wants you to try and do this yourself.

This is a really educational task to solve. Suggest you go through your coarse material on how to setup a form.

A form will allow the user to input data.

Then check that the data entered is correct and allowable e.g. you can't order more than 20 pizzas.

As far as I'm concerned if you do your best to try and solve it or learn how to solve the parts of it then you've been a good student.

What level at school are you in?

I'm in my last year of community college and the teacher does want us to learn it on our own, but we are allowed a little help. The book does not really help because the book is not a small basic book so all the examples have different terminology. The examples we do in class are sort of far off from what we do from homework so they are only a tad bit helpful. I'm not even sure how to set up a form only a menu. This is only our 5th week in class.
Saturday, October 3, 2015 3:09 PM

I'm interested to help you. But I do not speak English. I can not do the job quickly.

If it's good for you, then tell me.

I think any help your willing to provide will be greatly appreciated. As long as your able to help me before Wednesday the 7th then we are all good.
Saturday, October 3, 2015 3:10 PM
• You start easy:

Ask the user for the number of pizzas, check the number and for a number outside the range display an error massage.  Get this samll program working before going on.  Then build the nest step, and so on.

Jan [ WhTurner ] The Netherlands

That is the easy part and I know how to do that, but its the more complex stuff I do not understand. The book is not much help because it is not a small basic book so the terminology is not the same which gets confusing. Any other help your willing to give me would be greatly appreciated, but I do know i need to learn to do it myself. All I need is a few pointers or starting points because nothing is clicking with me and our in class examples do bot help that much.
Saturday, October 3, 2015 3:11 PM
• That is the easy part and I know how to do that, but its the more complex stuff I do not understand. The book is not much help because it is not a small basic book so the terminology is not the same which gets confusing. Any other help your willing to give me would be greatly appreciated, but I do know i need to learn to do it myself. All I need is a few pointers or starting points because nothing is clicking with me and our in class examples do bot help that much.

Understood. It's very difficult to learn without a book mapping to the language.

There are some good Small Basic books out there that a teacher can use. Could you have your teacher email me?

https://social.msdn.microsoft.com/Forums/en-US/2a5bc56e-c0fc-45ff-a9be-2af599e8d5e0/small-basic-teachers-and-educators-join-our-network?forum=smallbasic

Can you comb through the Getting Started Guide and Curriculum? And the Reference docs? You'll learn a ton and answer your questions you have here.

Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)