.ZIP

# Pizza Program Solution

You and several friends decide to order some pizzas, and you agree to split the cost. It is assumed then that each person will get a fair share of the purchase, so the problem is to figure out how many slices that is.

The pizza slices must be divided as equally as possible, but slices will not be further cut into fractions. It is possible that some will get one more slice more than others, but the difference must never be more than one.

You will be given the number of people involved, and the number of whole pizzas (where each pie is divided into eight slices. Determine how many slices each may get.

Sample Interfaces

How many people are sharing pizza? S

How many pizzas will be ordered? 2

You will divide 16 slices 4 will have 3 and I will have 4

people Sharing 3

many Will be ordered? 1

You divide E - - 1 will have 2 and 2 have 3.

Exact spacing and spelling is not required correct calculation is far more important.

Extra Credit Option

Some people might limit themselves to 2 slices. Well, that just leaves the more for everyone else. For this option, assume that a fair share is at least two, and then figure out how the pizza will be distributed. For example,

Coding and Documentation

The solution is limited to language elements already presented in class i.e. computations.

There may be no loops or conditional statements to solve the problem.

Conditional statements are permitted for cosmetic purposes (i.e. to eliminate the '(s)' or to avoid displaying O's) but those will not be counted for the score here.

Documentation standards in my course are rather loose. Your program development may be faster and more accurate if documentation is included in the design phase --documentation should never be viewed as something to tack on at the end.

But these are features that would likely help this portion of your grade:

The name of the author appears early within the file Variable names are meaningful, and not just single letters

Existing comments show there was a design phase before implementation

• In obvious calculations are clearly explained in the comments

Imagine that your future self was to give you your solution today to read, without saying anything. Your present self should be able to skim the program from top to bottom, know exactly what it is doing and why, and believe that it is obviously correct. If you have to puzzle out what your program means, even after you have completed it, it needs better .

The pizza slices must be divided as equally as possible, but slices will not be further cut into fractions. It is possible that some will get one more slice more than others, but the difference must never be more than one.

You will be given the number of people involved, and the number of whole pizzas (where each pie is divided into eight slices. Determine how many slices each may get.

Sample Interfaces

How many people are sharing pizza? S

How many pizzas will be ordered? 2

You will divide 16 slices 4 will have 3 and I will have 4

people Sharing 3

many Will be ordered? 1

You divide E - - 1 will have 2 and 2 have 3.

Exact spacing and spelling is not required correct calculation is far more important.

Extra Credit Option

Some people might limit themselves to 2 slices. Well, that just leaves the more for everyone else. For this option, assume that a fair share is at least two, and then figure out how the pizza will be distributed. For example,

Coding and Documentation

The solution is limited to language elements already presented in class i.e. computations.

There may be no loops or conditional statements to solve the problem.

Conditional statements are permitted for cosmetic purposes (i.e. to eliminate the '(s)' or to avoid displaying O's) but those will not be counted for the score here.

Documentation standards in my course are rather loose. Your program development may be faster and more accurate if documentation is included in the design phase --documentation should never be viewed as something to tack on at the end.

But these are features that would likely help this portion of your grade:

The name of the author appears early within the file Variable names are meaningful, and not just single letters

Existing comments show there was a design phase before implementation

• In obvious calculations are clearly explained in the comments

Imagine that your future self was to give you your solution today to read, without saying anything. Your present self should be able to skim the program from top to bottom, know exactly what it is doing and why, and believe that it is obviously correct. If you have to puzzle out what your program means, even after you have completed it, it needs better .

You'll get a 123.7KB .ZIP file.