## Project: Football Passer Rating (with Assertions)

The passer rating formula provides one metric that can be used to compare the performance of quarterbacks. It is based on the number of completions, touchdown passes, interceptions and total passing yards. Write a program that prompts for the number of completed passes, touchdown passes, interceptions, total passing yards, the total number of attempted passes and whether the NFL or NCAA passer rating should be displayed. Print the rating to one decimal place.

The program should call one of two functions to compute the NFL or NCAA passer rating. Each function should have pre-conditions that check for the following:

- Attempts are greater or equal to zero
- Completions are greater or equal to zero
- Touchdown passes are greater or equal to zero
- Interceptions are greater or equal to zero
- Passing yards are greater or equal to zero
- Completions plus interceptions is less than or equal to total passing attempts

Each function should also have post-conditions the enforce the minimum and maximum possible value for passer rating:

- NFL Minimum: 0.0
- NFL Maximum: 158.3
- NCAA Minimum: −731.6
- NCAA Maximum: 1261.6

See [[Passer Rating]] for the NFL and NCAA formulas.

## Output

**g++ -std=c++11 FootballPasserRating4.cpp -o FootballPasserRating4 -lfmt**$

**./FootballPasserRating4**Number of attempts:

**497**Number of completions:

**340**Number of touchdown passes:

**33**Number of interceptions:

**5**Number of passing yards:

**4208**1 for NFL or 2 for NCAA:

**1**$

**g++ -std=c++11 FootballPasserRating4.cpp -o FootballPasserRating4 -lfmt**$

**./FootballPasserRating4**Number of attempts:

**355**Number of completions:

**245**Number of touchdown passes:

**43**Number of interceptions:

**6**Number of passing yards:

**3966**1 for NFL or 2 for NCAA:

**2**NCAA Passer rating: 199.4 $

**g++ -std=c++11 FootballPasserRating4.cpp -o FootballPasserRating4 -lfmt**$

**./FootballPasserRating4**Number of attempts:

**1**Number of completions:

**1**Number of touchdown passes:

**1**Number of interceptions:

**1**Number of passing yards:

**1**1 for NFL or 2 for NCAA:

**1**Precondition failed: completions + interceptions <= attempts, File FootballPasserRating4.cpp Line 24.