Design and Test Cases Due: Friday, February 26, midnight

Source Code Due: Friday, March 5, midnight

Use the Canvas link for submitting both files. Both files should be .py files.

**Note about collaboration:**
As stated in the syllabus and on the first day of class, you are allowed
to choose ONE other student from this class and work with them as a partner.
Either student must NOT have already worked with someone else in the class
on this assignment.
Pairs are allowed, not triples nor chains nor rings!
Choose partners BEFORE the due date. You do not want to make your partner late too!
You must reference your partner AND they must reference you in the submitted
work of both of work, regardless of which direction the "help" went.
All program source code and designs will be checked for similarity.
If similarity is found and no references are given, it will be investigated
for plagiarism.

Assignment total points = Design (20 points) + Test Case Answers (15 points) + Runs given test cases successfully (15 points) + Implementation correctly written (60 points) = 110 points

Educational Goals: The educational goals of this program are that the student should use the concepts of

- design using pseudocode
- documentation
- output of prompts and labels to match specified output
- input of values from the keyboard
- translating algebraic equations into Python expressions
- using math library functions and constants
- calculations in assignment statements
- priority of arithmetic operations
- using formatting in print statements
- Using if statements to detect invalid inputs
- testing with valid inputs and invalid inputs

**Problem Description:**

Your programs run on a "chip", a CPU. This chip is manufactured on a silicon wafer, a very very thin circular slice of purified silicon with some impurities added to it. A silicon wafer usually has many chips (or dies) created on its surface by automated tools and robots, then at one point in the process the wafer is sliced apart to make individual CPUs (or dies). Your program will do some calculations about these wafers and chips. Follow this link for more information.

Given the diameter of the silicon wafer in millimeters (mm), the area of the wafer in square millimeters (mm^{2}) and the area of one individual chip (die) in square millimeters (mm^{2}),
this equation will calculate how many dies can be cut from the wafer. The equation corrects for wasted material
near the edges. Note that it should give an **integer** number of dies (you don't want to cut half a die).
Note that the area of the wafer is NOT an input value. You will have to calculate the area of
the wafer given the diameter. If you need to, look up the formula for the area of a circle.

Where:
* DiesPerWafer* (the number of dies cut from a wafer) = the answer
*waferDiameter* = the diameter of the wafer (mm)
*dieArea* = the chip size (mm^{2})
*waferArea* = area of the wafer (mm^{2}) (must be calculated ahead of time)

**Input Validation**

There are situations where this equation fail.
If the size of the chip is negative, the equation will crash because of taking the
square root of a negative number. If the size of the chip is zero, it will crash
because of division by zero.

Your program should check the chip size for those cases and give a message to the user about a nonsensical die area instead of crashing.

Sample Run

*** Slicing Wafers *** What is the diameter of the wafer? (mm) 255.5 What is the area of a single die? (mm^2) 17.0 From a wafer with area 51270.99 square millimeters you can cut 2878 dies. This does not take into account defective dies, alignment markings and test sites on the wafer's surface.

Sample Run

*** Slicing Wafers *** What is the diameter of the wafer? (mm) 400 What is the area of a single die? (mm^2) 25.0 From a wafer with area 125663.71 square millimeters you can cut 4848 dies. This does not take into account defective dies, alignment markings and test sites on the wafer's surface.

Another Sample Run (note input validation)

*** Slicing Wafers *** What is the diameter of the wafer? (mm) 8 What is the area of a single die? (mm^2) -5 Impossible die_area value. No dies possible.

Another Sample Run (note input validation)

*** Slicing Wafers *** What is the diameter of the wafer? (mm) 250 What is the area of a single die? (mm^2) 0 Impossible die_area value. No dies possible.

**Test Plan (30 points)** Make sure your program gives these results.
Part of our grading process will be to run your program with these cases.
You get 15 points for working the results for A., B., and C. by hand.
You get 15 points when your program gives the same results when we run them.

Description | Inputs wafer diameter, die area | Expected Outputs wafer Area, number of dies cut |
---|---|---|

Normal and boundary cases | ||

Normal case | 400, 25.0 | A. |

Normal case | 320, 75.0 | B. |

Normal case | 450, 12.5 | C. |

Boundary case, the two fractions in the formula are the same | 8, 8 | 50.27, 0 |

Boundary case, diameter is zero, die size does not matter | 0, 2.5 | 0.00, 0 |

Error cases | ||

Die size is impossible, diameter does not matter | 10, -1 | Error message |

Die size is impossible, diameter does not matter | 10, 0 | Error message |

**(20 points) Design:**

Write the design for the program in pseudocode as comments,
and submit it to Canvas as "design1.py".
**NOTE that we do not want Python code in this file!**
Just comments which can be used in the implementation later.

- Give the three P's (purpose, pre- and post-conditions) and author info as usual.
**The steps do NOT have to be numbered**.# supply program prolog (3 P's) # main function # Display introductory message Your design here # if die area is less than or equal to zero, # output error message Your design here

**(60 points) Implementation:**

Write a Python program to implement your design. Start by making a copy of the Python file you have that has the design in it (possibly modified with improvements you or your partner came up with) and write your Python code between the commented lines of the design. Make sure you eliminate any syntax and semantics errors. Here is where test cases are important!

Specifications for the implementation

- This program uses input; you will have to prompt the user for the inputs. The inputs can be assumed to be floats.
- You must use at least one function and one constant from the math library.
- Format the calculated wafer area to 2 places.
- You should have a main function and all code except for the import statement should be inside the main function definition.
- Make sure you format the lines of the output as described.
The line breaks and the punctuation should be as shown.
The output messages should be
**exactly**as given.