Python

Pizza

 

12 points

 

In this program, the user inputs the radius and cost of a pizza. The program uses a function to calculate the pizza's area, circumference and cost per square inch.

The first task is to set up the Graphical User Interface (GUI) by adding various elements (Text, Entry, Button, etc.) to the GraphWin.


The screenshot above shows the Pizza program running. The various widgets are labeled in red.

After the GUI is set up, you complete the program logic.

 

Video

The video below shows a completed program being run.

 

Starting Point

Download Pizza.py as a starting point for the project. The file guides you towards completing the program.

 

Extra Credit

3 points

In the extra credit version, you give the user the option to add toppings. Charge $1 per topping, and include the cost of the toppings when the program calculates the cost per square inch. The video below shows a program, with the extra credit, being run.

 

The idea for this program came from Python Programming: An Introduction to Computer Science, Second Edition by John Zelle.